diff --git a/services/project-history/app/js/SyncManager.js b/services/project-history/app/js/SyncManager.js index 9eefa258b9..98611f70ca 100644 --- a/services/project-history/app/js/SyncManager.js +++ b/services/project-history/app/js/SyncManager.js @@ -75,11 +75,16 @@ export function startHardResync(projectId, options, callback) { if (err) { return releaseLock(OError.tag(err)) } - RedisManager.destroyDocUpdatesQueue(projectId, function (err) { + RedisManager.clearFirstOpTimestamp(projectId, function (err) { if (err) { return releaseLock(OError.tag(err)) } - _startResyncWithoutLock(projectId, options, releaseLock) + RedisManager.destroyDocUpdatesQueue(projectId, function (err) { + if (err) { + return releaseLock(OError.tag(err)) + } + _startResyncWithoutLock(projectId, options, releaseLock) + }) }) }), function (error) { diff --git a/services/project-history/app/js/UpdatesProcessor.js b/services/project-history/app/js/UpdatesProcessor.js index f797a5c5dc..503e0b1fd6 100644 --- a/services/project-history/app/js/UpdatesProcessor.js +++ b/services/project-history/app/js/UpdatesProcessor.js @@ -82,10 +82,8 @@ export function processUpdatesForProject(projectId, callback) { OError.tag(error) } ErrorRecorder.record(projectId, queueSize, error, callback) - if (error == null) { - // clear the flush marker in the background if the queue was fully cleared - RedisManager.clearFirstOpTimestamp(projectId) - } + // clear the timestamp in the background if the queue is now empty + RedisManager.clearDanglingFirstOpTimestamp(projectId, () => {}) } ) }