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(pubsublite): close clients after publisher and subscriber have terminated #3512

Merged
merged 7 commits into from Jan 19, 2021

Conversation

@tmdiep
Copy link
Contributor

@tmdiep tmdiep commented Jan 8, 2021

The gapic clients aren't closed once the PublisherClient and SubscriberClient have terminated. This leaves client connections open. We could add an explicit Close() (like the AdminClient) and require users to call it, but we know when the publisher and subscriber have permanently terminated (i.e. when PublisherClient.Stop is called, and when SubscriberClient.Receive returns), so we'll can just close all the gapic clients internally.

This caused all unit tests to fail because a single connection to the mock lite server was being reused. The first test would close it, causing all subsequent tests to fail. So the unit test clients were refactored to create new connections for every test.

@tmdiep tmdiep requested a review from hongalex Jan 8, 2021
@tmdiep tmdiep requested a review from as a code owner Jan 8, 2021
@google-cla google-cla bot added the cla: yes label Jan 8, 2021
@tmdiep tmdiep requested a review from hongalex Jan 19, 2021
Copy link
Member

@hongalex hongalex left a comment

LGTM pending one comment

pubsublite/admin_test.go Outdated Show resolved Hide resolved
@tmdiep tmdiep merged commit 72d2aff into googleapis:master Jan 19, 2021
3 checks passed
@tmdiep tmdiep deleted the close_clients branch Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants