From a8b14552c0069f22026e794412a87cd920174f42 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 19 Dec 2017 12:27:57 +0000 Subject: [PATCH 1/2] allow flush to succeed when doc is already deleted --- .../document-updater/app/coffee/ProjectManager.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/document-updater/app/coffee/ProjectManager.coffee b/services/document-updater/app/coffee/ProjectManager.coffee index fe7867319d..03b57acf53 100644 --- a/services/document-updater/app/coffee/ProjectManager.coffee +++ b/services/document-updater/app/coffee/ProjectManager.coffee @@ -20,10 +20,15 @@ module.exports = ProjectManager = do (doc_id) -> jobs.push (callback) -> DocumentManager.flushDocIfLoadedWithLock project_id, doc_id, (error) -> - if error? + if error? and error instanceof Errors.NotFoundError + logger.warn err: error, project_id: project_id, doc_id: doc_id, "found deleted doc when flushing, removing from redis" + callback() + else if error? logger.error err: error, project_id: project_id, doc_id: doc_id, "error flushing doc" errors.push(error) - callback() + callback() + else + callback() logger.log project_id: project_id, doc_ids: doc_ids, "flushing docs" async.series jobs, () -> From 0b583dd4e6bc699ad5d25a976122d275cb7d42bb Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 20 Dec 2017 13:26:57 +0000 Subject: [PATCH 2/2] fix log message --- services/document-updater/app/coffee/ProjectManager.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/document-updater/app/coffee/ProjectManager.coffee b/services/document-updater/app/coffee/ProjectManager.coffee index 03b57acf53..abe5818e34 100644 --- a/services/document-updater/app/coffee/ProjectManager.coffee +++ b/services/document-updater/app/coffee/ProjectManager.coffee @@ -21,7 +21,7 @@ module.exports = ProjectManager = jobs.push (callback) -> DocumentManager.flushDocIfLoadedWithLock project_id, doc_id, (error) -> if error? and error instanceof Errors.NotFoundError - logger.warn err: error, project_id: project_id, doc_id: doc_id, "found deleted doc when flushing, removing from redis" + logger.warn err: error, project_id: project_id, doc_id: doc_id, "found deleted doc when flushing" callback() else if error? logger.error err: error, project_id: project_id, doc_id: doc_id, "error flushing doc"