From bf93fc3f5036acd2e298c50965f55a9413f19d8c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 19 Dec 2016 13:26:21 +0000 Subject: [PATCH] run health check max 1 a at a time --- .../filestore/app/coffee/HealthCheckController.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/filestore/app/coffee/HealthCheckController.coffee b/services/filestore/app/coffee/HealthCheckController.coffee index 2eaa08e1f6..25027a5bdd 100644 --- a/services/filestore/app/coffee/HealthCheckController.coffee +++ b/services/filestore/app/coffee/HealthCheckController.coffee @@ -25,7 +25,6 @@ checkCanStoreFiles = (callback)-> checkFileConvert = (callback)-> imgPath = path.join(settings.path.uploadFolder, "/tiny.pdf") - console.log imgPath, settings.path.uploadFolder async.waterfall [ (cb)-> fs.copy("./tiny.pdf", imgPath, cb) @@ -37,14 +36,18 @@ checkFileConvert = (callback)-> isOk = true +q = async.queue (task, callback)-> + task(callback) -runCheckInBackground = -> + +runChecks = (callback)-> async.parallel [checkFileConvert, checkCanStoreFiles], (err)-> if err? logger.err err:err, "Health check: error running" isOk = false else isOk = true + callback() module.exports = @@ -53,4 +56,4 @@ module.exports = res.send 200 else res.send 500 - runCheckInBackground() + q.push runChecks # run in background 1 at a time