mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #49 from sharelatex/ho-one-cpu-size
if host has 1 cpu (staging) then set availableWorkingCpus to 1
This commit is contained in:
commit
6aea5199c8
1 changed files with 7 additions and 1 deletions
|
@ -176,7 +176,13 @@ server = net.createServer (socket) ->
|
|||
socket.destroy()
|
||||
|
||||
currentLoad = os.loadavg()[0]
|
||||
|
||||
# On staging there may be 1 cpu on host, don't want to set availableWorkingCpus to 0 in that instance
|
||||
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