MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / square_sum

Function square_sum

ch6-thread-pool/worker.js:10–14  ·  view source on GitHub ↗
(max)

Source from the content-addressed store, hash-verified

8
9const commands = {
10 async square_sum(max) {
11 await new Promise((res) => setTimeout(res, 100));
12 let sum = 0; for (let i = 0; i < max; i++) sum += Math.sqrt(i);
13 return sum;
14 }
15};
16
17parentPort.on('message', asyncOnMessageWrap(async ({ method, params, id }) => ({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected