Expand description
Per-daemon proxy activity: what the proxy is carrying for each daemon right now, and when it last carried anything.
Every unit of work the proxy does for a daemon holds an [ActivityGuard]
for as long as it lasts:
- an HTTP request, until its response body has been sent in full, so a streamed or server-sent-events response counts for as long as it streams;
- an upgraded connection (WebSocket), until either side closes it;
- a TLS passthrough connection, until either side closes it;
- an auto-start, for the daemon and every dependency it brings up.
An idle keep-alive connection holds nothing: it is the requests on it that count. Name resolution is not activity either, since a browser resolves names speculatively.
The same lock that counts activity also records a daemon being stopped for inactivity, so the two cannot interleave: a stop is only claimed while nothing is in flight, and nothing new begins while a stop is claimed.