- From: Paul Draper <notifications@github.com>
- Date: Mon, 12 Jun 2023 02:41:57 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 12 June 2023 09:42:02 UTC
@jakearchibald there is a memory leak if a not-first signals has already been aborted.
The fix:
```ts
function anySignal(signals: Iterable<AbortSignal>): AbortSignal {
const controller = new AbortController();
for (const signal of signals) {
if (signal.aborted) {
controller.abort(signal.reason); // add this
return signal;
}
signal.addEventListener("abort", () => controller.abort(signal.reason), {
signal: controller.signal,
});
}
return controller.signal;
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/905#issuecomment-1586972104
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/fetch/issues/905/1586972104@github.com>
Received on Monday, 12 June 2023 09:42:02 UTC