Expand description
When the low-disk note goes out and what it says (build_cache_service::disk_check sends it).
Pure functions, so the decisions are tested without a disk, a clock or a running agent.
The first version went to the owners of the three largest workspaces whatever their size, once an hour for as long as the free space hovered at the threshold, as a message that starts a turn. On one host an agent with a 3.5 GB folder was woken eight times in three hours, and the text set “43 GB free” next to “below the 20 GB / 10% level”. Now:
- a note goes out again only after free space falls a further
MORE_DROP, or the level gets worse (warning to critical), and at most once an hour: never on a timer alone; - the disk counts as recovered only with room to spare (
recovered), so free space bouncing across the threshold is one event, not many; - the text says which rule tripped and which did not;
- a warning is held for the agent’s next turn; only a critical level starts one.
Structs§
- Sent
- The last note that went out.
Enums§
- Level
- How low the disk is.
Constants§
- BIG_
INCREMENTAL - Or whose incremental caches total this much.
- BIG_
WORKSPACE - A workspace whose build folders total this much hears of the warning.
- MIN_
GAP_ SECS - A note goes out at most this often (seconds), unless the level got worse.
- MORE_
DROP - Free space must fall this much below what the last note reported to be worth another note, and rise this much above the warning level to count as recovered.
- RECOVER_
PCT - Percentage points above the warning percentage that count as recovered.
Functions§
- clear_
sent - Forgets the last note, because the disk recovered.
- level
- The level of
freeoftotalbytes underpolicy. - note_
text - The note: how low the disk is, which rule tripped, and
lines(the folders it is about) underheading. - read_
sent - The record of the last note, shared by every AgentMux on the host. A file from the first version holds only a time: that note reported nothing about free space, so it counts as one sent at today’s free space and nothing follows until it drops further.
- recovered
- Whether the disk is back above the warning level with room to spare, so the next drop is a new event. Right at the threshold it is not: free space that bounces across it stays one event.
- should_
send - Whether a note goes out now.
previs the last one,now_levelthe level now (notOk),freethe free bytes now andnow_sunix seconds. - why
- Why
freeoftotalis low, in numbers, and which rule tripped: the percentage, the size, or both. Both are shown with the one that did not trip marked as such, so “43 GB free” never sits next to a 20 GB level as if it were below it. - write_
sent - Records that a note went out. Only called once someone received it: a note nobody got must not use up the drop.