MCPcopy Create free account
hub / github.com/Sethispr/image-compressor / getWorkerFromPool

Function getWorkerFromPool

services/workerService.ts:28–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 * Gets a worker from the recycle bin (pool) or makes a new one.
27 */
28const getWorkerFromPool = (): Worker => {
29 if (workerPool.length > 0) {
30 return workerPool.pop()!;
31 }
32 return new Worker(getWorkerBlobUrl(), {type: 'module'});
33};
34
35/**
36 * Returns a used worker to the pool so it can process the next image.

Callers 1

processImageInWorkerFunction · 0.85

Calls 1

getWorkerBlobUrlFunction · 0.85

Tested by

no test coverage detected