Merge pull request #251 from overleaf/ho-load-shed-mvp

very basic mvp for shedding load
This commit is contained in:
Henry Oswald 2021-06-28 11:00:21 +01:00 committed by GitHub
commit d22bb95ab3

View file

@ -331,7 +331,7 @@ const loadTcpServer = net.createServer(function (socket) {
const freeLoad = availableWorkingCpus - currentLoad const freeLoad = availableWorkingCpus - currentLoad
let freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100) let freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
if (freeLoadPercentage <= 0) { if (freeLoadPercentage <= 0) {
freeLoadPercentage = 1 // when its 0 the server is set to drain and will move projects to different servers freeLoadPercentage = 0 // when its 0 the server is set to drain and will move projects to different servers
} }
socket.write(`up, ${freeLoadPercentage}%\n`, 'ASCII') socket.write(`up, ${freeLoadPercentage}%\n`, 'ASCII')
return socket.end() return socket.end()