Repository navigation
Commit 930e640
fix(logs): a restart between polls no longer saves the new run's first lines twice (#111)
A `container logs -f` opened during one run streams on into the next run
after a restart, with nothing in between. When a container was stopped
and started again between two polls (the Restart button does that), the
old run's follower stored the new run's first lines under the old run,
and the new run's follower stored them again from its replay.
A follower now holds what it reads and stores a row only once a check
that began after the row was read found the container still in its run:
each poll (the supervisor passes the poll's start instant to the
followers it keeps; no extra process), or its own `inspect` when it holds
1 MB. When a poll finds the container out of the run, the supervisor
tells the follower to stop instead of aborting it. The follower wraps up
before the container's next task starts: if `inspect` still shows its
run, it stores everything it holds; if the container moved on, it reads
the current log once, drops the held rows that are its beginning
(matched by text bytes, KMP), and stores the rest (e.g. the old run's
shutdown messages). Rows held when cgui quits are dropped and replayed by
the next follower. Saved rows lag the log by up to one poll interval.
`logpersist::reconcile` takes the poll's start instant.
Live test (c2) restarts a followed container between polls; it fails
with the old behaviour (the new run's first 28 lines under the old run).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 692cd70 commit 930e640
4 files changed
Lines changed: 653 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
443 | | - | |
| 444 | + | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
0 commit comments