keep flushQueuedProjects in the foreground

This commit is contained in:
Brian Gough 2019-09-27 10:46:24 +01:00
parent 7561e05660
commit 260923f291

View file

@ -216,14 +216,15 @@ module.exports = HttpController =
res.send project_ids res.send project_ids
flushQueuedProjects: (req, res, next = (error) ->) -> flushQueuedProjects: (req, res, next = (error) ->) ->
res.setTimeout(10 * 60 * 1000)
options = options =
limit : req.query.limit || 1000 limit : req.query.limit || 1000
timeout: 5 * 60 * 1000 timeout: 5 * 60 * 1000
min_delete_age: req.query.min_delete_age || 5 * 60 * 1000 min_delete_age: req.query.min_delete_age || 5 * 60 * 1000
res.send 204
# run the flush in the background
DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)-> DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)->
if err? if err?
logger.err err:err, "error flushing old projects" logger.err err:err, "error flushing old projects"
res.send 500
else else
logger.log {flushed: flushed}, "flush of queued projects completed" logger.log {flushed: flushed}, "flush of queued projects completed"
res.send {flushed: flushed}