diff --git a/services/document-updater/app/coffee/DeleteQueueManager.coffee b/services/document-updater/app/coffee/DeleteQueueManager.coffee index 3fc6b3f644..731cdf77b7 100644 --- a/services/document-updater/app/coffee/DeleteQueueManager.coffee +++ b/services/document-updater/app/coffee/DeleteQueueManager.coffee @@ -64,10 +64,12 @@ module.exports = DeleteQueueManager = flushNextProject() startBackgroundFlush: () -> + SHORT_DELAY = 10 + LONG_DELAY = 1000 doFlush = () -> if Settings.shuttingDown logger.warn "discontinuing background flush due to shutdown" return - DeleteQueueManager.flushAndDeleteOldProjects {timeout:1000,min_delete_age:3*60*1000,limit:1000}, () -> - setTimeout doFlush, 10 + DeleteQueueManager.flushAndDeleteOldProjects {timeout:1000,min_delete_age:3*60*1000,limit:1000}, (err, flushed) -> + setTimeout doFlush, (if flushed > 10 then SHORT_DELAY else LONG_DELAY) doFlush()