Various homeserver state FST and queue fixes #101

Open
l1s5 wants to merge 6 commits from l1s5/out-of-your-element:homeserver-online-check-fixes into main

6 commits

Author SHA1 Message Date
a04daf2fb8
matrix: write tests for homeserver status machinery 2026-10-30 00:07:32 +09:00
01da1ae497
matrix: await queued m2d packets
This ensures that all m2d packets in the queue arrives in the order they
were queued, as well as being able to catch and log any errors.
2026-10-29 23:50:10 +09:00
e1f14ff1b9
matrix: ignore stale ping results in homeserver status machinery
On the off chance that something invokes `waitForOnline` during
`checking` or `offline` (e.g. on a `GUILD_CREATE` event from discord),
the state might have changed in between we send a ping and receive it.
This commit adds guards to not act on such a stale ping result.
2026-10-29 23:50:09 +09:00
2c650742f0
matrix: refactor d2m packet enqueuing
Merge `setErrorWithPacket` into `queuePacket`.
Also set a more accurate type.
2026-10-29 23:50:08 +09:00
a723c1c1a6
matrix: queue d2m events while checking the homeserver
During a "check assume offline" at startup, `isRealTime()` is false,
so incoming Discord events get queued, but `queuePacket()` asserted that we
were offline or recovering. The updated assertion implicitly adds `checking`
to the list of valid states, allowing packets to be queued in this state.
2026-10-29 23:39:29 +09:00
caf5f4ad71
matrix: fix homeserver checks
`checkingWhileOnline` compared against "check while online", but the
transition is called "check assume online", so it was always false.
2026-10-28 08:18:37 +09:00