mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -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()
|
flushNextProject()
|
||||||
|
|
||||||
startBackgroundFlush: () ->
|
startBackgroundFlush: () ->
|
||||||
|
SHORT_DELAY = 10
|
||||||
|
LONG_DELAY = 1000
|
||||||
doFlush = () ->
|
doFlush = () ->
|
||||||
if Settings.shuttingDown
|
if Settings.shuttingDown
|
||||||
logger.warn "discontinuing background flush due to shutdown"
|
logger.warn "discontinuing background flush due to shutdown"
|
||||||
return
|
return
|
||||||
DeleteQueueManager.flushAndDeleteOldProjects {timeout:1000,min_delete_age:3*60*1000,limit:1000}, () ->
|
DeleteQueueManager.flushAndDeleteOldProjects {timeout:1000,min_delete_age:3*60*1000,limit:1000}, (err, flushed) ->
|
||||||
setTimeout doFlush, 10
|
setTimeout doFlush, (if flushed > 10 then SHORT_DELAY else LONG_DELAY)
|
||||||
doFlush()
|
doFlush()
|
||||||
|
|
Loading…
Reference in a new issue