MCPcopy Create free account
hub / github.com/Effect-TS/effect / runBatch

Function runBatch

packages/effect/src/rpc/RpcClient.ts:1069–1080  ·  view source on GitHub ↗
(clientId: number, batch: Batch)

Source from the content-addressed store, hash-verified

1067 // Runs in the client scope rather than in a caller, so interrupting one
1068 // caller does not cancel the HTTP request for the rest of the batch.
1069 const runBatch = (clientId: number, batch: Batch) =>
1070 Effect.raceFirst(Effect.sleep(window), batch.full.await).pipe(
1071 Effect.andThen(Effect.suspend(() => {
1072 closeBatch(clientId, batch)
1073 return withBatchSpan(exchange.send(clientId, batch.requests, batch.accepted), batch.requests)
1074 })),
1075 Effect.onExit((exit) => {
1076 closeBatch(clientId, batch)
1077 Deferred.doneUnsafe(batch.accepted, Exit.asVoid(exit))
1078 return Deferred.done(batch.done, exit)
1079 })
1080 )
1081 const send = Effect.fnUntraced(function*(clientId: number, request: RequestEncoded) {
1082 let batch = batches.get(clientId)
1083 if (batch === undefined) {

Callers 1

RpcClient.tsFile · 0.70

Calls 7

closeBatchFunction · 0.85
withBatchSpanFunction · 0.85
onExitMethod · 0.80
pipeMethod · 0.65
sleepMethod · 0.65
sendMethod · 0.65
doneMethod · 0.45

Tested by

no test coverage detected