add random jitter to cutoff time

This commit is contained in:
Brian Gough 2019-10-01 15:01:20 +01:00
parent a32495d2b4
commit 2c22a60052

View file

@ -23,7 +23,7 @@ async = require "async"
module.exports = DeleteQueueManager = module.exports = DeleteQueueManager =
flushAndDeleteOldProjects: (options, callback) -> flushAndDeleteOldProjects: (options, callback) ->
startTime = Date.now() startTime = Date.now()
cutoffTime = startTime - options.min_delete_age cutoffTime = startTime - options.min_delete_age + 100 * (Math.random() - 0.5)
count = 0 count = 0
flushProjectIfNotModified = (project_id, flushTimestamp, cb) -> flushProjectIfNotModified = (project_id, flushTimestamp, cb) ->