MCPcopy Create free account
hub / github.com/electric-sql/electric / worker

Function worker

packages/agents-runtime/src/create-handler.ts:396–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394 let nextIndex = 0
395
396 const worker = async (): Promise<void> => {
397 while (nextIndex < items.length) {
398 const index = nextIndex++
399 if (index >= items.length) return
400 await handler(items[index]!)
401 }
402 }
403
404 const workerCount = Math.max(1, Math.min(concurrency, items.length))
405 await Promise.all(Array.from({ length: workerCount }, () => worker()))

Callers 2

forEachWithConcurrencyFunction · 0.85
pglite-worker.tsFile · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected