Merge pull request #16 from sharelatex/bg-handle-ops-after-delete

allow flush to succeed when doc is already deleted
This commit is contained in:
Brian Gough 2017-12-20 14:41:05 +00:00 committed by GitHub
commit 85de4f2bc5

View file

@ -20,10 +20,15 @@ module.exports = ProjectManager =
do (doc_id) -> do (doc_id) ->
jobs.push (callback) -> jobs.push (callback) ->
DocumentManager.flushDocIfLoadedWithLock project_id, doc_id, (error) -> 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"
callback()
else if error?
logger.error err: error, project_id: project_id, doc_id: doc_id, "error flushing doc" logger.error err: error, project_id: project_id, doc_id: doc_id, "error flushing doc"
errors.push(error) errors.push(error)
callback() callback()
else
callback()
logger.log project_id: project_id, doc_ids: doc_ids, "flushing docs" logger.log project_id: project_id, doc_ids: doc_ids, "flushing docs"
async.series jobs, () -> async.series jobs, () ->