fix: the pending banner now knows about the daily-restart schedule - #70
Merged
Conversation
Same shape as the Autostart switch, found by looking for more of it rather
than waiting for it to be reported: two mechanisms mean "restart once empty",
and the page only knew about one.
the panel's restart_pending column, queued from the UI, acted on by
_run_due_restarts()
the box's set_daily_restart() writes `0 5 * * * touch ~/.restart-pending`
plus an hourly line that restarts once gamedig sees 0 players
The panel WRITES that cron and then cannot see it. So with Daily restart on
and players connected at 05:00, a restart really is queued — and the banner
that exists to say exactly that stayed hidden until it happened.
The monitor sweep already talks to every host once a minute, so it now also
runs one `ls -1d /home/*/.restart-pending` per host and maps the paths back to
game users. The detail page shows the banner for either source and names the
schedule when it is the cron's.
Display only, deliberately. Nothing writes restart_pending from the flag: the
two queues stay independent, so a server cannot be restarted twice by both
tickers racing, and the panel's own queue is never cleared by a box that
happens not to have the file.
Both halves are tested, because the first version was not. The banner check
set the dict directly, so removing the code that POPULATES it still passed —
mutation caught that, and there is now a monitor test that drives a real pass
with the flag stubbed. Removing either half fails: the banner mutation trips
one check, the monitor mutation trips three.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.48% coverage variation (-1.00%) |
| Diff coverage | ✅ 50.00% diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (b1ec072) 11957 5772 48.27% Head commit (9b6e464) 11965 (+8) 5833 (+61) 48.75% (+0.48%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#70) 8 4 50.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
Same shape as the Autostart switch — found by going looking for more of it rather than waiting for it to be reported.
Two mechanisms mean "restart once empty", and the page only knew about one:
restart_pendingcolumn, queued from the UI, acted on by_run_due_restarts()set_daily_restart()writes0 5 * * * touch ~/.restart-pendingplus an hourly line that restarts once gamedig sees 0 playersThe panel writes that cron and then can't see it. So with Daily restart on and players connected at 05:00, a restart genuinely is queued — and the banner that exists to say exactly that stayed hidden until it fired.
Fix
The monitor sweep already talks to every host once a minute, so it now also runs one
ls -1d /home/*/.restart-pendingper host and maps the paths back to game users. The detail page shows the banner for either source, and names the schedule when it's the cron's.Display only, deliberately. Nothing writes
restart_pendingfrom the flag: the two queues stay independent, so a server can't be restarted twice by both tickers racing, and the panel's own queue is never cleared by a box that happens not to have the file.Both halves tested — because the first version wasn't
My banner check set the dict directly, so deleting the code that populates it still passed. Mutation caught that. There's now a monitor test that drives a real pass with the flag stubbed:
unit 839 · smoke 300 → 307 · rbac 65 · manage 21 · template_actions 7 · lint clean.
🤖 Generated with Claude Code