From 6754bdca1cb8a789d7229e563ffed531fb97f48f Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 5 Jan 2016 11:30:24 +0000 Subject: [PATCH] log timestamp in human-readable form for inconsistent ops --- services/track-changes/app/coffee/UpdatesManager.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/track-changes/app/coffee/UpdatesManager.coffee b/services/track-changes/app/coffee/UpdatesManager.coffee index d2b8683fdf..c52d920cb7 100644 --- a/services/track-changes/app/coffee/UpdatesManager.coffee +++ b/services/track-changes/app/coffee/UpdatesManager.coffee @@ -37,8 +37,10 @@ module.exports = UpdatesManager = rawUpdates.shift() if rawUpdates[0]? and rawUpdates[0].v != lastVersion + 1 - error = new Error("Tried to apply raw op at version #{rawUpdates[0].v} to last compressed update with version #{lastVersion}") - logger.error err: error, doc_id: doc_id, project_id: project_id, "inconsistent doc versions" + ts = lastCompressedUpdate?.meta?.end_ts + last_timestamp = if ts? then new Date(ts) else 'unknown time' + error = new Error("Tried to apply raw op at version #{rawUpdates[0].v} to last compressed update with version #{lastVersion} from #{last_timestamp}") + logger.error err: error, doc_id: doc_id, project_id: project_id, prev_end_ts: ts, "inconsistent doc versions" if Settings.trackchanges?.continueOnError and rawUpdates[0].v > lastVersion + 1 # we have lost some ops - continue to write into the database, we can't recover at this point lastCompressedUpdate = null