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: event-handler leakage #788

Merged
merged 7 commits into from
Jan 26, 2024
Merged

fix: event-handler leakage #788

merged 7 commits into from
Jan 26, 2024

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Jan 25, 2024

Fixes an issue where event handlers could be leaked if the same handler reference was added multiple times.

Fixes an issue where event handlers could be leaked if the same handler reference was added twice to different events

Signed-off-by: Todd Baert <[email protected]>
@toddbaert toddbaert requested a review from a team as a code owner January 25, 2024 20:41
@toddbaert toddbaert marked this pull request as draft January 25, 2024 21:17
@toddbaert
Copy link
Member Author

toddbaert commented Jan 25, 2024

It occurred to me this fix is incomplete. It still possible to add the same handler to the same event twice and lose the first ref. I have another fix in mind. Marked as draft for now

@toddbaert
Copy link
Member Author

toddbaert commented Jan 26, 2024

Hey @beeme1mr @lukas-reining please re-review. As mentioned here, we also need to support the addition and removal of duplicate handlers to the same event. This is done by making the weakmap values arrays, and appending/popping them (this is consistent with how nodes event handlers work).

I've added this functionality, and 2 relevant tests.

@toddbaert toddbaert marked this pull request as ready for review January 26, 2024 15:15
Signed-off-by: Todd Baert <[email protected]>
@toddbaert toddbaert added this pull request to the merge queue Jan 26, 2024
Merged via the queue into main with commit 69c7f05 Jan 26, 2024
9 checks passed
@toddbaert toddbaert deleted the fix/event-handler-leaks branch January 26, 2024 18:14
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.0.24](core-v0.0.23...core-v0.0.24)
(2024-01-27)


### ✨ New Features

* adds ErrorOptions to Error constructor
([#765](#765))
([2f59a9f](2f59a9f))


### 🐛 Bug Fixes

* event-handler leakage
([#788](#788))
([69c7f05](69c7f05))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: OpenFeature Bot <[email protected]>
Signed-off-by: openfeature-peer-update-bot <[email protected]>
Co-authored-by: openfeature-peer-update-bot <[email protected]>
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