Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix listener leak for timers/promises #497

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

WhiteAutumn
Copy link
Contributor

Purpose (TL;DR)

Fix abort event listener leak discussed in #495 by adding abortListenerMap to keep track of active abort listeners.

Solution

The leak is fixed by adding a map with listener functions as keys and the abort signals as values. During uninstall it iterates over the map and removes the listeners. If a timer is aborted or finishes on its own the listener signal pair will be removed from the map.

@fatso83 fatso83 merged commit 6f90a44 into sinonjs:main Aug 23, 2024
11 checks passed
@fatso83
Copy link
Contributor

fatso83 commented Aug 24, 2024

Great addition. Both this and the previous PR is very nice work! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants