fs/session: add debug logging to statewait handler

Logs the agent name and base value each time statewait is
read, and whether WaitChange returned ok or !ok.
This commit is contained in:
Ollie Agent 2026-08-01 21:10:55 +02:00
parent a7359fffcf
commit 1a600fb9eb
1 changed files with 3 additions and 0 deletions

View File

@ -367,11 +367,14 @@ func (h *agentHelper) fileSpec(name string, mode os.FileMode) FileSpec {
if base == "" {
base = h.ag.State()
}
h.log.Debug("statewait: begin base=%q ag=%q", base, h.ag.Name())
v, ok := h.ag.WaitChange(ctx, agent.WatchState, base)
if !ok {
s := h.ag.State()
h.log.Debug("statewait: !ok returning state=%q", s)
return []byte(s + "\n"), s, nil
}
h.log.Debug("statewait: ok returning state=%q", v)
return []byte(v + "\n"), v, nil
}
}