Skip to content
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

Explicitly get the latest work state when updating heartbeat #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swrichards
Copy link

@swrichards swrichards commented Feb 10, 2025

The previous update_heartbeat method assumed that, if there was a worker update within the update_freq for a given host, there would only be a single instance. However, we have seen cases in the wild where this was not the case. This code guards against this edge-case by using .latest() rather than .get().


Intended as a fix for this issue.

The previous update_heartbeat method assumed that, if there was
a worker update within the update_freq for a given host, there
would only be a single instance. However, we have seen cases in the
wild where this was not the case. This code guards against this
edge-case by using .latest() rather than .get().
@swrichards swrichards force-pushed the fix-multiple-worker-state-race-condition branch from 0fcc604 to f1e7075 Compare February 10, 2025 13:38
@swrichards swrichards changed the title Explicit get the latest work state when updating heartbeat Explicitly get the latest work state when updating heartbeat Feb 10, 2025
@swrichards swrichards marked this pull request as ready for review February 10, 2025 13:41
Copy link
Member

@alextreme alextreme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed solves the problem but with multiple WorkerState's we don't know if after choosing the latest other problems won't appear because of this.

I propose that we catch this duplicate WorkerState situation and delete all but the latest

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.

2 participants