Migrate System store to Sync by default (#10838)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3e6fed8df4
Коммит
f8a89a52fc
@@ -36,7 +36,7 @@ func MakeMigrationsList() []string {
|
||||
}
|
||||
|
||||
func GetMigrationState(migration string, store store.Store) (string, *model.Job, *model.AppError) {
|
||||
if result := <-store.System().GetByName(migration); result.Err == nil {
|
||||
if _, err := store.System().GetByName(migration); err == nil {
|
||||
return MIGRATION_STATE_COMPLETED, nil, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -30,16 +30,16 @@ func TestGetMigrationState(t *testing.T) {
|
||||
Name: migrationKey,
|
||||
Value: "true",
|
||||
}
|
||||
res1 := <-th.App.Srv.Store.System().Save(&system)
|
||||
assert.Nil(t, res1.Err)
|
||||
err = th.App.Srv.Store.System().Save(&system)
|
||||
assert.Nil(t, err)
|
||||
|
||||
state, job, err = GetMigrationState(migrationKey, th.App.Srv.Store)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, job)
|
||||
assert.Equal(t, "completed", state)
|
||||
|
||||
res2 := <-th.App.Srv.Store.System().PermanentDeleteByName(migrationKey)
|
||||
assert.Nil(t, res2.Err)
|
||||
_, err = th.App.Srv.Store.System().PermanentDeleteByName(migrationKey)
|
||||
assert.Nil(t, err)
|
||||
|
||||
// Test with a job scheduled in "pending" state.
|
||||
j1 := &model.Job{
|
||||
|
||||
@@ -157,8 +157,8 @@ func (worker *Worker) runMigration(key string, lastDone string) (bool, string, *
|
||||
}
|
||||
|
||||
if done {
|
||||
if result := <-worker.app.Srv.Store.System().Save(&model.System{Name: key, Value: "true"}); result.Err != nil {
|
||||
return false, "", result.Err
|
||||
if saveErr := worker.app.Srv.Store.System().Save(&model.System{Name: key, Value: "true"}); saveErr != nil {
|
||||
return false, "", saveErr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user