Эх сурвалжийг харах

return failed and succesfully flushed projects when flushing everything

Henry Oswald 7 жил өмнө
parent
commit
d9a737f97c

+ 9 - 2
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