summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 01:21:25 -0300
committerGabriel Schneider <[email protected]>2026-11-20 02:08:31 -0300
commitc9ac46755632d5cd1bdc34fe211112d730ffc77f (patch)
tree1db2a819b04acec388faaa50590c8ba7b837a4ed /runtime
parentdaee60fa42540864a89357a28b73033158158425 (diff)
downloadpardes-c9ac46755632d5cd1bdc34fe211112d730ffc77f.tar.gz
pardes-c9ac46755632d5cd1bdc34fe211112d730ffc77f.zip
replica: a client measures how far behind its session it is and past two seconds lets its link go and joins again from a dump, saying so once (P32 (b); step 3, item 2): the fault shown first (a client whose units came 2.1 s later than its quickest took them on: Link.quit false) and in the soak (the far client never let go: one join, its final screen 17.7 s after the flood's end); Link.behind, each unit's head's session clock against the client's own (Link.time), less the smallest difference seen; one constant, behind_max_ms = 2,000, near and far; past it the link let go (the bye's `again`, its view kept), the notice "joined again: N.N s behind" (Link.rejoins), the first unit after a join past it taken as the link now (a session's clock stood still while its machine slept; a dump that took longer than the bound: never a let-go at once, never a loop); the clock is the client's machine's, read in Link alone (no new line on root.zig's machine_lines; Link is no part of Pardes, so no digest or dump reaches it); a test that fed a simulated client clock with units of the real clock made them on its own clock; the soak counts the let-gos and how far behind each client fell; tui core-test 859/1009 (150 skipped), shell-test 1045/1048, term-test 17/17; the soak, screen state (--clients 5, 4 seeds): diverged 0, unequal 0, deltas 7093/0 7518/0 7603/0, quiet 590/0 472/0 541/0, unlisted 0, corpus 22 of 22, the far client 9/9/7 let-gos, others 0; bytes (--seeds 8): the far client shows its final screen in every run, 6.5-7.9 s after the flood's end, refreshed every 7.0-7.3 s (p50), others 0 let-gos and 2-10 ms behind at most, quiet 1077/0 1083/0 1457/0, unequal 0, BUT 5/3/1 near clients diverged at joins (reports/pardes-term-lag.md: open); ReleaseFast (2 seeds, 80 ms): 0 diverged, a join's unit on a client already there 9.6 ms p50, 17.7 ms at worst, the session's join step 1.4/14.3 ms
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime')
-rw-r--r--runtime/client.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/client.zig b/runtime/client.zig
index 544be588..a2d89ab9 100644
--- a/runtime/client.zig
+++ b/runtime/client.zig
@@ -137,8 +137,9 @@ pub fn Loop(comptime Frontend: type) type {
l.link.take(msg);
}
- /// A join a pass: the first, and one after the replica diverged or
- /// the session let it go to upgrade; the frontend stays as it is.
+ /// A join a pass: the first, and one after the replica diverged, fell
+ /// too far behind (replica.behind_max_ms) or the session let it go
+ /// (to upgrade, or cut off); the frontend stays as it is.
pub fn run(l: *L, s: *Start) !Ended {
const link = &l.link;
while (true) {
@@ -151,7 +152,7 @@ pub fn Loop(comptime Frontend: type) type {
l.after();
}
if (s.env.get("PARDES_REPLICA_STATS")) |file| link.writeStats(file);
- if (!link.gone) replica.bye(s.joined.fd, s.r.diverged != null);
+ if (!link.gone) replica.bye(s.joined.fd, s.r.diverged != null or link.lagged != 0);
// The link's reader ends with the link, posting as it goes:
// what it posted is let go until it has (a terminal's queue
// is bounded: a reader blocked on it would never end).