From d9a737f97ca35f0182f505aeff52a5761dfb61a4 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 13 Jun 2019 14:21:38 +0100 Subject: [PATCH] return failed and succesfully flushed projects when flushing everything --- .../document-updater/app/coffee/ProjectFlusher.coffee | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/document-updater/app/coffee/ProjectFlusher.coffee b/services/document-updater/app/coffee/ProjectFlusher.coffee index fabc334930..c84d759804 100644 --- a/services/document-updater/app/coffee/ProjectFlusher.coffee +++ b/services/document-updater/app/coffee/ProjectFlusher.coffee @@ -56,8 +56,15 @@ ProjectFlusher = jobs = _.map project_ids, (project_id)-> return (cb)-> ProjectManager.flushAndDeleteProjectWithLocks project_id, cb - async.parallelLimit jobs, options.concurrency, (error)-> - return callback(error, project_ids) + async.parallelLimit async.reflectAll(jobs), options.concurrency, (error, results)-> + success = [] + failure = [] + _.each results, (result, i)-> + if result.error? + failure.push(project_ids[i]) + else + success.push(project_ids[i]) + return callback(error, {success:success, failure:failure}) module.exports = ProjectFlusher \ No newline at end of file