mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 11:53:40 -05:00
make background flush more adaptive
This commit is contained in:
parent
73b4262186
commit
a32495d2b4
1 changed files with 4 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue