mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fix migration phase check
This commit is contained in:
parent
a85dffbcef
commit
a2e63d009e
1 changed files with 3 additions and 3 deletions
|
@ -114,7 +114,7 @@ class MigrationClient
|
||||||
@rclient_new = redis.createClient(new_settings)
|
@rclient_new = redis.createClient(new_settings)
|
||||||
@new_key_schema = new_settings.key_schema
|
@new_key_schema = new_settings.key_schema
|
||||||
@migration_phase = new_settings.migration_phase
|
@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) ->
|
getMigrationStatus: (key, migrationKey, callback) ->
|
||||||
async.series [
|
async.series [
|
||||||
|
@ -132,7 +132,7 @@ class MigrationClient
|
||||||
project_id = getProjectId(key)
|
project_id = getProjectId(key)
|
||||||
migrationKey = @new_key_schema.projectHistoryMigrationKey({project_id})
|
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?
|
return callback(err) if err?
|
||||||
# In all cases, if the migration key exists we must always write to the
|
# In all cases, if the migration key exists we must always write to the
|
||||||
# new redis, unless we are rolling back.
|
# 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"
|
logger.debug {project_id}, "using old client because migration key does not exist"
|
||||||
return callback(null, @rclient_old)
|
return callback(null, @rclient_old)
|
||||||
else
|
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'))
|
callback(new Error('invalid migration phase'))
|
||||||
multi: () ->
|
multi: () ->
|
||||||
new Multi(@)
|
new Multi(@)
|
||||||
|
|
Loading…
Reference in a new issue