Repository navigation
Wait for the subscription confirmation (pubsub.Receive) before returning the watch. - #379
Closed
Haven Xia (HavenXia) wants to merge 1 commit into
Closed
Haven Xia (HavenXia) wants to merge 1 commit into
Haven Xia (HavenXia) wants to merge 1 commit into
Conversation
returning the watch.
Haven Xia (HavenXia)
force-pushed
the
fix-watchworkers-subscribe-race
branch
from
July 7, 2026 23:32
916b447 to
773fc34
Compare
Haven Xia (HavenXia)
marked this pull request as ready for review
July 7, 2026 23:36
| pubsub := s.rdb.Subscribe(watchCtx, workerPubSubChannel) | ||
| // Wait for the server to confirm the subscription; otherwise events published | ||
| // right after we return can race the SUBSCRIBE and be lost for good. | ||
| if _, err := pubsub.Receive(watchCtx); err != nil { |
Collaborator
There was a problem hiding this comment.
Is this guaranteed to be non-blocking?
Member
Author
There was a problem hiding this comment.
I don't think it's non-blocking, should we wrap it with a timeout?
Also I noticed this change has already been merged to main in #353 that did the exact same thing.
Member
Author
|
Close as a duplicate of #353 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Attempt to fix the flaky run-tests
Hit this during tests
The test failed at 1st run but succeed in the 2nd attempt without any change.

ListWorkerfinds workers butWatchWorkersfailed since it use the workerCache code path to check existence. So making sure we receive the pub/sub message should fix it.