ciguest: fail fast when the watcher dies #1
Open@ogirardot wants to merge
fix/watcher into main1 file changed
modified
internal/watcher/watch.go +3 -3 | @@ -2,9 +2,9 @@ package watcher | ||
| 2 | 2 | |
| 3 | 3 | // Watch drives the guest loop: poll, apply, report. |
| 4 | 4 | // |
| 5 | -// Fail fast: a silent watcher is worse than a dead one, so any poll or | |
| 6 | -// apply error is returned to the caller (cmd/ciguest exits non-zero and | |
| 7 | -// the supervisor restarts us) instead of being logged and forgotten. | |
| 5 | +// Fail fast: a silent watcher is worse than a dead one — a poll or apply | |
| 6 | +// error is returned to the caller, cmd/ciguest exits non-zero, and the | |
| 7 | +// supervisor restarts us instead of us polling forever on a broken socket. | |
| 8 | 8 | func Watch(interval string) error { |
| 9 | 9 | tick := parseInterval(interval) |
Clamp or refuse: a zero interval here silently busy-loops the guest. | ||
| 10 | 10 | for range tick { |
| @@ -2,9 +2,9 @@ package watcher | |||
| 2 | 2 | ||
| 3 | // Watch drives the guest loop: poll, apply, report. | 3 | // Watch drives the guest loop: poll, apply, report. |
| 4 | // | 4 | // |
| 5 | -// Fail fast: a silent watcher is worse than a dead one, so any poll or | 5 | +// Fail fast: a silent watcher is worse than a dead one — a poll or apply |
| 6 | -// apply error is returned to the caller (cmd/ciguest exits non-zero and | 6 | +// error is returned to the caller, cmd/ciguest exits non-zero, and the |
| 7 | -// the supervisor restarts us) instead of being logged and forgotten. | 7 | +// supervisor restarts us instead of us polling forever on a broken socket. |
| 8 | func Watch(interval string) error { | 8 | func Watch(interval string) error { |
| 9 | tick := parseInterval(interval) | 9 | tick := parseInterval(interval) |
| 10 | for range tick { | 10 | for range tick { |
Nice — failing loudly here is exactly what the nightly job needs.