mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
if host has 1 cpu (staging) then set availableWorkingCpus to 1
This commit is contained in:
parent
1af44b32b3
commit
a7623bf0d2
1 changed files with 6 additions and 1 deletions
|
@ -176,7 +176,12 @@ server = net.createServer (socket) ->
|
|||
socket.destroy()
|
||||
|
||||
currentLoad = os.loadavg()[0]
|
||||
availableWorkingCpus = os.cpus().length - 1
|
||||
|
||||
if os.cpus().length == 1
|
||||
availableWorkingCpus = 1
|
||||
else
|
||||
availableWorkingCpus = os.cpus().length - 1
|
||||
|
||||
freeLoad = availableWorkingCpus - currentLoad
|
||||
freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
|
||||
if freeLoadPercentage <= 0
|
||||
|
|
Loading…
Reference in a new issue