if host has 1 cpu (staging) then set availableWorkingCpus to 1

This commit is contained in:
Henry Oswald 2017-02-20 15:16:52 +00:00
parent 1af44b32b3
commit a7623bf0d2

View file

@ -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