Skip to content

fix: pubsub goroutines in tests #7677

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

Merged
merged 1 commit into from
May 25, 2023
Merged

fix: pubsub goroutines in tests #7677

merged 1 commit into from
May 25, 2023

Conversation

spikecurtis
Copy link
Contributor

The new pubsub spawns a goroutine that runs until the subscription is canceled.

ReplicaSync closes its subscription when its context expires, but in testing, we never expired the context at the end of the test, and so we could leak goroutines associated with their subscriptions. This PR fixes the tests.

I also noticed that it was possible to leak a goroutine if we fail to listen for an event; also addressed by this PR.

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis requested a review from mtojek May 25, 2023 10:29
@spikecurtis spikecurtis changed the title Fix: pubsub goroutines in tests fix: pubsub goroutines in tests May 25, 2023
@spikecurtis spikecurtis merged commit 05da1e9 into main May 25, 2023
@spikecurtis spikecurtis deleted the spike/pubsub-test-leaks branch May 25, 2023 10:46
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants