rptest/kgo: avoid extra wait on shutdown #21358
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are 2 ways to stop a kgo service. One is graceful shutdown and another one is hard stop. We use 2
threading.Event
objects to signal this.Before this change, the polling thread would only wait on the
_stop_requested
and if it was set or if a timeout is hit (self.INTERVAL=5s) it would run the loop again and check if stop or shutdown was requested.This leads for shutdown taking 5s more than it should in worst case.
We avoid this extra wait but settling on a single threading.Event object (_shutdown_requested) for signaling that the loop should run again. Then we signal that event from both, shutdown and hard stop.
Backports Required
Release Notes