This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Update replicator to use a timeout and to automatically stop watching when a final phase is seen. #57
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.
Digging into issue #55 I found that the thread hanging was caused by
kubernetes.watch.Watch
not obeying thestop
message. This happens becausestop
is only evaluated afterwatch.stream
yields and it will stop yielding when the job we're watching is complete. This PR makes two adjustments to the way we're handling the watcher:pod_watch_timeout_seconds
towatch.stream
which means that if any given request thatwatch
makes times out then our thread will exit.watch.stop
is explicitly called whenever a 'final' phase is seen.These two changes should ensure that the thread exits at most
pod_watch_timeout_seconds
seconds after the last event is seen, and in most cases the thread should exit immediately after a flow-run is complete.Closes #55
Checklist
pre-commit
checks.pre-commit install && pre-commit run --all
locally for formatting and linting.