Ver código fonte

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

Henry Oswald 9 anos atrás
pai
commit
a7623bf0d2
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      services/clsi/app.coffee

+ 6 - 1
services/clsi/app.coffee

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