mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-22 19:37:38 +00:00
Allow draining to be prevented in CLSI agent
Co-authored-by: Brian Gough <brian.gough@overleaf.com> Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com> GitOrigin-RevId: f55de7783cb1c14108eb347eebb74ec329180000
This commit is contained in:
parent
fe878a88d1
commit
59b708e3f7
2 changed files with 9 additions and 2 deletions
|
@ -343,7 +343,10 @@ const loadTcpServer = net.createServer(function (socket) {
|
|||
const freeLoadPercentage = Math.round(
|
||||
(freeLoad / availableWorkingCpus) * 100
|
||||
)
|
||||
if (freeLoadPercentage <= 0) {
|
||||
if (
|
||||
Settings.internal.load_balancer_agent.allow_maintenance &&
|
||||
freeLoadPercentage <= 0
|
||||
) {
|
||||
// When its 0 the server is set to drain implicitly.
|
||||
// Drain will move new projects to different servers.
|
||||
// Drain will keep existing projects assigned to the same server.
|
||||
|
@ -351,7 +354,7 @@ const loadTcpServer = net.createServer(function (socket) {
|
|||
socket.write(`maint, 0%\n`, 'ASCII')
|
||||
} else {
|
||||
// Ready will cancel the maint state.
|
||||
socket.write(`up, ready, ${freeLoadPercentage}%\n`, 'ASCII')
|
||||
socket.write(`up, ready, ${Math.max(freeLoadPercentage, 1)}%\n`, 'ASCII')
|
||||
}
|
||||
socket.end()
|
||||
} else {
|
||||
|
|
|
@ -37,6 +37,10 @@ module.exports = {
|
|||
report_load: process.env.LOAD_BALANCER_AGENT_REPORT_LOAD !== 'false',
|
||||
load_port: 3048,
|
||||
local_port: 3049,
|
||||
allow_maintenance:
|
||||
(
|
||||
process.env.LOAD_BALANCER_AGENT_ALLOW_MAINTENANCE ?? ''
|
||||
).toLowerCase() !== 'false',
|
||||
},
|
||||
},
|
||||
apis: {
|
||||
|
|
Loading…
Add table
Reference in a new issue