Skip to content

Conversation

@rohanpm
Copy link
Contributor

@rohanpm rohanpm commented Jul 22, 2021

Clients use thread-based executors under the hood, but we did not
provide any mechanism to shut them down. This is bad design as it means
there's no reliable way to limit the number of spawned threads if you
need to create many clients (e.g. while running a test suite where
new clients are being created in each test).

Make it work in a 'with' statement so it's possible to shut down all
threads associated with the client; attempting to use a client after
shutdown will raise an error. It's not mandatory, but usage of 'with'
is recommended, so several examples and docs were updated to do that.

FakeClient doesn't use any threads but is intended to have as close as
possible behavior to a real Client, so it also raises the same errors
if used after shutdown.

This is similar in spirit to
release-engineering/pushsource@1ebda2c.

Clients use thread-based executors under the hood, but we did not
provide any mechanism to shut them down. This is bad design as it means
there's no reliable way to limit the number of spawned threads if you
need to create many clients (e.g. while running a test suite where
new clients are being created in each test).

Make it work in a 'with' statement so it's possible to shut down all
threads associated with the client; attempting to use a client after
shutdown will raise an error. It's not mandatory, but usage of 'with'
is recommended, so several examples and docs were updated to do that.

FakeClient doesn't use any threads but is intended to have as close as
possible behavior to a real Client, so it also raises the same errors
if used after shutdown.

This is similar in spirit to
release-engineering/pushsource@1ebda2c.
@rohanpm rohanpm marked this pull request as ready for review July 22, 2021 05:12
@rohanpm rohanpm requested a review from a team July 22, 2021 05:12
@rohanpm rohanpm merged commit a2508fb into release-engineering:master Jul 25, 2021
@rohanpm rohanpm deleted the client-enter-exit branch July 25, 2021 22:30
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