(clientId: number, batch: Batch)
| 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) { |
no test coverage detected