Migrate System store to Sync by default (#10838)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3e6fed8df4
Коммит
f8a89a52fc
30
app/app.go
30
app/app.go
@@ -110,18 +110,19 @@ func (a *App) EnsureDiagnosticId() {
|
||||
if a.Srv.diagnosticId != "" {
|
||||
return
|
||||
}
|
||||
if result := <-a.Srv.Store.System().Get(); result.Err == nil {
|
||||
props := result.Data.(model.StringMap)
|
||||
|
||||
id := props[model.SYSTEM_DIAGNOSTIC_ID]
|
||||
if len(id) == 0 {
|
||||
id = model.NewId()
|
||||
systemId := &model.System{Name: model.SYSTEM_DIAGNOSTIC_ID, Value: id}
|
||||
<-a.Srv.Store.System().Save(systemId)
|
||||
}
|
||||
|
||||
a.Srv.diagnosticId = id
|
||||
props, err := a.Srv.Store.System().Get()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
id := props[model.SYSTEM_DIAGNOSTIC_ID]
|
||||
if len(id) == 0 {
|
||||
id = model.NewId()
|
||||
systemId := &model.System{Name: model.SYSTEM_DIAGNOSTIC_ID, Value: id}
|
||||
a.Srv.Store.System().Save(systemId)
|
||||
}
|
||||
|
||||
a.Srv.diagnosticId = id
|
||||
}
|
||||
|
||||
func (a *App) HTMLTemplates() *template.Template {
|
||||
@@ -144,11 +145,10 @@ func (a *App) Handle404(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (a *App) getSystemInstallDate() (int64, *model.AppError) {
|
||||
result := <-a.Srv.Store.System().GetByName(model.SYSTEM_INSTALLATION_DATE_KEY)
|
||||
if result.Err != nil {
|
||||
return 0, result.Err
|
||||
systemData, appErr := a.Srv.Store.System().GetByName(model.SYSTEM_INSTALLATION_DATE_KEY)
|
||||
if appErr != nil {
|
||||
return 0, appErr
|
||||
}
|
||||
systemData := result.Data.(*model.System)
|
||||
value, err := strconv.ParseInt(systemData.Value, 10, 64)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("getSystemInstallDate", "app.system_install_date.parse_int.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
|
||||
Ссылка в новой задаче
Block a user