PB-927: introduce Baton and BatonHolder#3722
Closed
zhming0 wants to merge 1 commit intopb-927-update-agent-to-consume-the-new-connectrpc-endpointfrom
Closed
PB-927: introduce Baton and BatonHolder#3722zhming0 wants to merge 1 commit intopb-927-update-agent-to-consume-the-new-connectrpc-endpointfrom
zhming0 wants to merge 1 commit intopb-927-update-agent-to-consume-the-new-connectrpc-endpointfrom
Conversation
8fa170e to
fbef1ec
Compare
DrJosh9000
reviewed
Mar 1, 2026
Comment on lines
+31
to
+32
| // for case expressions, so the caller must explicitly call Acquired after | ||
| // a successful receive: |
Contributor
There was a problem hiding this comment.
the caller must explicitly call Acquired after
a successful receive:
This is a key problem in trying to abstract this well.
DrJosh9000
reviewed
Mar 1, 2026
Comment on lines
-39
to
-50
| // We begin holding the toggle. (The ping loop is prevented from running.) | ||
| haveToggle := true | ||
|
|
||
| relinquishToggle := func() { | ||
| if !haveToggle { | ||
| // Nothing to do | ||
| return | ||
| } | ||
| a.logger.Debug("[runDebouncer] Relinquishing the toggle") | ||
| toggle <- struct{}{} | ||
| haveToggle = false | ||
| } |
Contributor
There was a problem hiding this comment.
This refactor seems to be the main win of this PR.
DrJosh9000
reviewed
Mar 1, 2026
Contributor
DrJosh9000
left a comment
There was a problem hiding this comment.
I think there are some good ideas here, mind if I not merge this and instead implement something sort of similar but different?
Contributor
Author
|
@DrJosh9000 no problem, it was meant to be a demo of idea. |
Contributor
|
It's much appreciated! |
2 tasks
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.
Description
Rework toggle -> Baton and BatonHolder.
More explicit protocol re which one hold the baton, which one is not.
Use descriptive method to encapsulate acquire and release operation.
As a result, caller no longer need to keep track of a
hasToggleconcept internally.Context
part of PB-927