mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 22:10:44 +00:00
Merge pull request #9231 from overleaf/jpa-clsi-lifespan-fix
[clsi] cycle VMs before their 24h limit with some jitter GitOrigin-RevId: c08bea6765dc8b03db9f0792a8bb20084f595f59
This commit is contained in:
parent
b449107411
commit
199ced5eef
1 changed files with 9 additions and 5 deletions
|
@ -240,15 +240,19 @@ app.get('/status', (req, res, next) => res.send('CLSI is alive\n'))
|
|||
|
||||
Settings.processTooOld = false
|
||||
if (Settings.processLifespanLimitMs) {
|
||||
Settings.processLifespanLimitMs +=
|
||||
// Pre-emp instances have a maximum lifespan of 24h after which they will be
|
||||
// shutdown, with a 30s grace period.
|
||||
// Spread cycling of VMs by up-to 2.4h _before_ their limit to avoid large
|
||||
// numbers of VMs that are temporarily unavailable (while they reboot).
|
||||
Settings.processLifespanLimitMs -=
|
||||
Settings.processLifespanLimitMs * (Math.random() / 10)
|
||||
logger.debug(
|
||||
'Lifespan limited to ',
|
||||
Date.now() + Settings.processLifespanLimitMs
|
||||
logger.info(
|
||||
{ target: new Date(Date.now() + Settings.processLifespanLimitMs) },
|
||||
'Lifespan limited'
|
||||
)
|
||||
|
||||
setTimeout(() => {
|
||||
logger.debug('shutting down, process is too old')
|
||||
logger.info({}, 'shutting down, process is too old')
|
||||
Settings.processTooOld = true
|
||||
}, Settings.processLifespanLimitMs)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue