Closed robertomonno77 closed 2 months ago
Hi @robertomonno77,
Thank you so much for reporting this, and you're absolutely right! The configuration wasn't being properly applied for concurrent mode, and the warmup process was being ignored. I’ve made the necessary changes.
The only case where the configuration will still be ignored is when working with an array of workers, which must be kept alive as there is no way to restore them once terminated.
To summarize, for your initial use case, everything should be working as expected now.
const worker = new EasyWebWorker(new URL('path to my static file', import.meta.url),
{
workerOptions: { type: 'module' },
maxWorkers: 4,
warmUpWorkers: true,
keepAlive: true,
}
);
The previous config will warm up 4 workers and keep them alive.
I noticed some performance issue configuring a pool of websocket in this way:
Basically here I would like to create a pool of 4 web-workers at the beginning of the configuration phase as the parameter warmUpWorkers suggests. Unfortunately from the tests I did it seems that the pool is not created immediately and this ends up with performance issue running the test application.
As a workaround my pseudo-code now looks like this one:
that seems to work correctly. I am not 100% sure this could be considered a bug (properly speaking), but something to share if anyone else needs...