mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
Slightly less aggressively preload workers.
This commit is contained in:
parent
1097d56d50
commit
6505064fb6
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@ module.exports = class God
|
|||
@ids[@lastID]
|
||||
|
||||
maxAngels: 2 # how many concurrent web workers to use; if set past 8, make up more names
|
||||
maxWorkerPoolSize: 2 # ~20MB per idle worker
|
||||
worldWaiting: false # whether we're waiting for a worker to free up and run the world
|
||||
constructor: ->
|
||||
@id = God.nextID()
|
||||
|
@ -30,8 +31,10 @@ module.exports = class God
|
|||
fillWorkerPool: =>
|
||||
return unless Worker
|
||||
@workerPool ?= []
|
||||
while @workerPool.length < @maxAngels
|
||||
if @workerPool.length < @maxWorkerPoolSize
|
||||
@workerPool.push @createWorker()
|
||||
if @workerPool.length < @maxWorkerPoolSize
|
||||
@fillWorkerPool()
|
||||
|
||||
getWorker: ->
|
||||
@fillWorkerPool()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue