From a2e63d009ee16a9064c0cb5ce3fd2ad7c9411812 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 16 Dec 2019 09:55:26 +0000 Subject: [PATCH] fix migration phase check --- .../app/coffee/RedisMigrationManager.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/document-updater/app/coffee/RedisMigrationManager.coffee b/services/document-updater/app/coffee/RedisMigrationManager.coffee index c00d7727af..f1ec00cf5c 100644 --- a/services/document-updater/app/coffee/RedisMigrationManager.coffee +++ b/services/document-updater/app/coffee/RedisMigrationManager.coffee @@ -114,7 +114,7 @@ class MigrationClient @rclient_new = redis.createClient(new_settings) @new_key_schema = new_settings.key_schema @migration_phase = new_settings.migration_phase - throw new Error("invalid migration phase") unless @migration_phase in ['prepare', 'start', 'switch', 'complete'] + throw new Error("invalid migration phase") unless @migration_phase in ['prepare', 'switch', 'rollback'] getMigrationStatus: (key, migrationKey, callback) -> async.series [ @@ -132,7 +132,7 @@ class MigrationClient project_id = getProjectId(key) migrationKey = @new_key_schema.projectHistoryMigrationKey({project_id}) - @getMigrationStatus key, migrationKey, (err, migrationKeyExists, newQueueExists, oldQueueExists) -> + @getMigrationStatus key, migrationKey, (err, migrationKeyExists, newQueueExists, oldQueueExists) => return callback(err) if err? # In all cases, if the migration key exists we must always write to the # new redis, unless we are rolling back. @@ -189,7 +189,7 @@ class MigrationClient logger.debug {project_id}, "using old client because migration key does not exist" return callback(null, @rclient_old) else - logger.error {key: key}, "unknown migration phase" + logger.error {key: key, migration_phase: @migration_phase}, "unknown migration phase" callback(new Error('invalid migration phase')) multi: () -> new Multi(@)