mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02: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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user