-
Notifications
You must be signed in to change notification settings - Fork 63
Restart stale watch threads where they left off #275
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
Conversation
47e6ec6 to
82855bc
Compare
If a watch thread fails for any reason (exception, timeout, etc...) restart it with the last resourceVersion so it picks up where it left off.
82855bc to
34a4a0a
Compare
|
Checked commit agrare@34a4a0a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
|
@cben going from your linked comment kubernetes/website#6540 (comment) I'm setting the collection resourceVersion to the latest notice.object's resourceVersion. Does this look like a valid approach? |
cben
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
You could drop start_watch_threads and always use ensure_watch_threads; ok to keep both if you want the prettier "Starting" vs "Restarting" logging.
| # object's resourceVersion so that if this watch has to be restarted | ||
| # it will pick up where it left off. | ||
| resource_version = notice.object.metadata.resourceVersion | ||
| resource_versions[entity_type] = resource_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this updates a shared hash (at distinct keys) from multiple threads, is that fully safe in ruby?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll use a Concurrent::Hash to be safe
|
Merging. I'll be on vacation all next week so will try to unblock as much stuff as possible today. |
If a watch thread fails for any reason (exception, timeout, etc...)
restart it with the last resourceVersion so it picks up where it left
off.