Repository navigation
feat(gateway): a waiting clock write names a computer that has stopped watching at once - #636
Merged
Merged
Conversation
…d watching at once A follower holds a watch up to 25 s and reconnects at once, so one whose last watch is older than that and 5 s more (ClockFollowers.QUIET_S) has lost its connection. A write given wait_followers_s waited its whole wait for such a computer; it now names it at once, and one that goes quiet during the wait ends it at its quiet deadline. One that hasn't watched yet is still waited for, as it may be starting. The 504 carries each computer's last shown version and when it last watched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of FD-5420: a computer's own clock follows the gateway's universe clock. #614 made clock writes able to wait for the computers following the clock (
wait_followers_s). This makes that wait stop for a computer that has lost its connection.The rest of what was #634 (clock writes behind the control token, watches bound to each computer's read token) is deferred with FD-5472, along with moving tokens out of environment variables.
What changes
ClockFollowers.QUIET_S) has lost its connection. A write givenwait_followers_snow names such a computer at once instead of waiting out its full time.stale_afterwakes at each acknowledgement and at the next quiet deadline of a computer it waits for.followers: each computer's last shown version and when it last watched.Without this, once core passes
wait_followers_s(FD-5473), a computer whose follower died would hold every clock change on it for the whole wait, up to 30 s.Testing
Unit:
tst/unit/env/gateway/clock_watch_test.pycovers:followers.All 988 gateway unit tests pass.
Integration, on an EC2 host (x86_64):
gateway_test.py's clock tests pass. These are the clock extension, its rate accuracy, the time triggers, the autonomous trigger andsync_env_clock.E2E, on the same host, against the branch's gateway image with two real follower processes long-polling under their read tokens:
SIGSTOP) for 36 s, then an advance waiting up to 10 s🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
Clock writes now stop waiting for computers whose last watch is at least 30 seconds old.
No actionable issues were found. Tests were inspected, not run.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD W[Clock write] --> C[Wake held watches] C --> S{Any followers behind?} S -->|No| OK[Return 200] S -->|Yes| A{Any still within quiet limit or never watched?} A -->|No| E[Return 504 with follower details] A -->|Yes| D{Wait deadline reached?} D -->|Yes| E D -->|No| P[Wait for acknowledgement or next deadline] P --> SReviews (3) · Last reviewed commit: "feat(gateway): a waiting clock write nam..." · Reviewed by Greptile