Currently if an AbortSignal is re-used across multiple requests, more and more listeners will accumulate, leading to memory leaks. In order to mitigate this, we should remove any event listeners we add to the AbortSignal when the request completes.
Notes on the code changes
Should we be more defensive and check that removeEventListener is a function before using it?
I don't really like the code changes in the fetch-http-handler so if anyone has any suggestions, please do chime in. It's somewhat tricky because fetch doesn't provide an event-driven API (that I know of).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #1318, if available:
Description of changes:
Currently if an
AbortSignal
is re-used across multiple requests, more and more listeners will accumulate, leading to memory leaks. In order to mitigate this, we should remove any event listeners we add to theAbortSignal
when the request completes.Notes on the code changes
removeEventListener
is a function before using it?fetch-http-handler
so if anyone has any suggestions, please do chime in. It's somewhat tricky becausefetch
doesn't provide an event-driven API (that I know of).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.