mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
add continuous background flush
This commit is contained in:
@@ -14,6 +14,7 @@ if Settings.sentry?.dsn?
|
||||
|
||||
RedisManager = require('./app/js/RedisManager')
|
||||
DispatchManager = require('./app/js/DispatchManager')
|
||||
DeleteQueueManager = require('./app/js/DeleteQueueManager')
|
||||
Errors = require "./app/js/Errors"
|
||||
HttpController = require "./app/js/HttpController"
|
||||
mongojs = require "./app/js/mongojs"
|
||||
@@ -146,3 +147,7 @@ module.exports = app
|
||||
|
||||
for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT']
|
||||
process.on signal, shutdownCleanly(signal)
|
||||
|
||||
if Settings.continuousBackgroundFlush
|
||||
logger.info "Starting continuous background flush"
|
||||
DeleteQueueManager.startBackgroundFlush()
|
||||
@@ -1,3 +1,4 @@
|
||||
Settings = require('settings-sharelatex')
|
||||
RedisManager = require "./RedisManager"
|
||||
ProjectManager = require "./ProjectManager"
|
||||
logger = require "logger-sharelatex"
|
||||
@@ -60,4 +61,13 @@ module.exports = DeleteQueueManager =
|
||||
count++ if flushed
|
||||
flushNextProject()
|
||||
|
||||
flushNextProject()
|
||||
flushNextProject()
|
||||
|
||||
startBackgroundFlush: () ->
|
||||
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
|
||||
doFlush()
|
||||
|
||||
@@ -95,3 +95,5 @@ module.exports =
|
||||
dsn: process.env.SENTRY_DSN
|
||||
|
||||
publishOnIndividualChannels: process.env['PUBLISH_ON_INDIVIDUAL_CHANNELS'] or false
|
||||
|
||||
continuousBackgroundFlush: process.env['CONTINUOUS_BACKGROUND_FLUSH'] or false
|
||||
|
||||
Reference in New Issue
Block a user