Merge pull request #9099 from overleaf/jpa-web-graceful-shutdown
[web] introduce graceful shutdown GitOrigin-RevId: f42793a96f1e0304c57a855241bffa32bb291864
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
*/
|
||||
let SystemMessageManager
|
||||
const { SystemMessage } = require('../../models/SystemMessage')
|
||||
const {
|
||||
addRequiredCleanupHandlerBeforeDrainingConnections,
|
||||
} = require('../../infrastructure/GracefulShutdown')
|
||||
|
||||
module.exports = SystemMessageManager = {
|
||||
getMessages(callback) {
|
||||
@@ -53,4 +56,14 @@ module.exports = SystemMessageManager = {
|
||||
|
||||
const CACHE_TIMEOUT = 10 * 1000 * (Math.random() + 2) // 20-30 seconds
|
||||
SystemMessageManager.refreshCache()
|
||||
setInterval(() => SystemMessageManager.refreshCache(), CACHE_TIMEOUT)
|
||||
const intervalHandle = setInterval(
|
||||
() => SystemMessageManager.refreshCache(),
|
||||
CACHE_TIMEOUT
|
||||
)
|
||||
|
||||
addRequiredCleanupHandlerBeforeDrainingConnections(
|
||||
'update system messages',
|
||||
() => {
|
||||
clearInterval(intervalHandle)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user