Skip to content

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

Merged
merged 1 commit into from
Aug 23, 2018

Conversation

agrare
Copy link
Member

@agrare agrare commented Aug 22, 2018

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.

@agrare agrare force-pushed the restart_stale_watch_threads branch 2 times, most recently from 47e6ec6 to 82855bc Compare August 22, 2018 20:04
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.
@agrare agrare force-pushed the restart_stale_watch_threads branch from 82855bc to 34a4a0a Compare August 22, 2018 20:05
@miq-bot
Copy link
Member

miq-bot commented Aug 22, 2018

Checked commit agrare@34a4a0a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@agrare
Copy link
Member Author

agrare commented Aug 22, 2018

@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?

Copy link
Contributor

@cben cben left a 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
Copy link
Contributor

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?

Copy link
Member Author

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

@cben cben added this to the Sprint 93 Ending Aug 27, 2018 milestone Aug 23, 2018
@cben cben self-assigned this Aug 23, 2018
@cben
Copy link
Contributor

cben commented Aug 23, 2018

Merging. I'll be on vacation all next week so will try to unblock as much stuff as possible today.

@cben cben merged commit 89f5fc2 into ManageIQ:master Aug 23, 2018
@agrare agrare deleted the restart_stale_watch_threads branch August 23, 2018 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants