Expand description
The presence publisher’s decisions, apart from its I/O. Given what just
happened ([Event]) and the time ([Now]), [Machine::next] settles the
state, says what to do ([Action]) and how long to wait before the next
[Event::Due]. Nothing here reads a clock, a random number or the
network, so every rule is tested with a fake clock; super::Driver runs
it against the relay.
| state | entered on | next try |
|---|---|---|
signed_out | no MuxBus sign-in | a sign-in (a local recheck every minute, no request) |
publishing | the record was stored | a minute, or a change of the snapshot |
retrying | unreachable, 5xx, 429, any other status | 5 s doubling to 5 min, full jitter; a 429’s Retry-After |
unsupported | 404, no presence route | about 5 min; at once on a sign-in, a network change, a wake, or a new relay version |
rejected | 400 or 410 | 10 min or more |
signed_off | a goodbye was stored at a sign-out | a sign-in |
off | this install doesn’t publish (super::policy) | turned on |
Outside publishing a change of the snapshot only marks it dirty: the
next try sends the latest one, no sooner. A 409 means the relay already
has a newer record of this install’s, which is as good as storing this
one.
A goodbye (a v3 record, gone) is due when something was published and
the relay takes v2 or later ([Machine::farewell]): an older relay would
refuse v3, so it gets none. Turning publishing off says it here
([Action::Goodbye]); a sign-out and a quit say it from outside, and a
sign-out tells the machine with [Event::Goodbye].
Two refusals get an immediate second try before rejected: a record the
relay can’t parse is sent again one version down, v4 then v2 then v1 (an
older relay knows no agent lines, an older one still no states), and the
version it took is then kept for that relay for [Config::v1_memory]; a
record whose time the relay refuses is sent again stamped with the
relay’s clock, learned from the Date of every answer.