Agent.Start and ConnectionManager.Start now take a context.Context. The
manager runs until that context is cancelled or the process receives
SIGINT/SIGTERM. On shutdown it waits for in-flight reconnect attempts
before closing connections.
The reconnect delay, WebSocket dial and pending handshake now stop when
the context is cancelled. A context-aware dialer keeps proxy selection
from the environment. WebSocket callbacks no longer block on eventChan
after the event loop exits. A late reconnect can no longer restart the
SSH server once shutdown begins.
BREAKING CHANGE: agent.Agent.Start now requires a context.Context.
---------
Co-authored-by: hank <hank@henrygd.me>
pb.realtime.subscribe() resolves only once the server has confirmed the
subscription. When the chart time changed away from 1m before that, the
effect cleanup ran with the initial no-op, the subscription stayed active,
and its 1m points kept overwriting the 1h history. Track cancellation,
unsubscribe as soon as the late subscription resolves, and ignore messages
that arrive after cleanup. Fixes#2598.
getRecord removed the system from the manager on any error, so a query that
timed out while the hub was stalled stopped the updater for good. The system
stayed 'up' in the database and was never polled again until a restart.
Only a record that is really gone removes the system now. (#2544)
PocketBase now marshals record JSON fields with encoding/json/v2, where
omitempty no longer omits zero numbers or false. This roughly doubled the
size of stored system_stats rows with zero-value keys. Switch scalar
fields to omitzero to restore the v1 output shape, and add a test that
compares v1 and v2 output for zero-heavy values.
unsafe_shutdowns was uint16, so drives reporting more than 65535 unsafe
shutdowns made json.Unmarshal fail and the entire NVMe SMART record was
discarded with only "no valid SMART data found" in the logs. Widen it
to uint, matching power_cycles (#2484), and log the unmarshal error at
debug level so similar failures are diagnosable.
Fixes#2582
The keepalive ping on a failed fetch re-arms the read deadline without needing
a reply, so a dead peer (power loss, partition) kept its connection until TCP
gave up. Track when the agent last sent a message and only ping while that is
under maxAgentSilence (3m). A live agent always answers within interval + its
own 120s deadline, so slow agents are unaffected; a dead one is now released
by the read deadline and falls back through the normal down/SSH path.
Raises the bandwidth threshold max to 5 GB/s without making the MB/s
slider less precise. Values are still stored in MB/s, and the unit is
inferred from the stored value when the alert sheet opens.