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
Contributor

Hi!

This PR fix some bugs in the homeserver state machinery.

The most important one is probably handling of messages that arrive while in the checking state, something that would previously cause an assertion error.

There is also a smaller one where a stale ping might might attempt an invalid state transition (and assumingly crash the program as a result).

I also merged setErrorWithPacket into queuePacket like we talked about, but not much refactoring beyond that. The new function infers any state transitions needed automatically.

Hi! This PR fix some bugs in the homeserver state machinery. The most important one is probably handling of messages that arrive while in the `checking` state, something that would previously cause an assertion error. There is also a smaller one where a stale ping might might attempt an invalid state transition (and assumingly crash the program as a result). I also merged `setErrorWithPacket` into `queuePacket` like we talked about, but not much refactoring beyond that. The new function infers any state transitions needed automatically.
`checkingWhileOnline` compared against "check while online", but the
transition is called "check assume online", so it was always false.
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.
Merge `setErrorWithPacket` into `queuePacket`
On the off chance that something invokes `waitForOnline` during the
checkphase (e.g. on a `GUILD_CREATE` event from discord),
the state might have changed in between we send a ping andr receive it.
This commit adds a small guard to not act on such a stale ping result.
l1s5 force-pushed homeserver-online-check-fixes from ff344ef73a to a04daf2fb8 2026-10-29 15:10:33 +00:00 Compare
Author
Contributor

New changes:

  • another stale ping check for offline
  • awaits for queued matrix events
  • a whole bunch of tests
New changes: - another stale ping check for `offline` - awaits for queued matrix events - a whole bunch of tests
l1s5 changed title from Homeserver checking state queue fixes to Various homeserver state FST and queue fixes 2026-10-29 15:14:08 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u homeserver-online-check-fixes:l1s5-homeserver-online-check-fixes
git switch l1s5-homeserver-online-check-fixes

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff l1s5-homeserver-online-check-fixes
git switch l1s5-homeserver-online-check-fixes
git rebase main
git switch main
git merge --ff-only l1s5-homeserver-online-check-fixes
git switch l1s5-homeserver-online-check-fixes
git rebase main
git switch main
git merge --no-ff l1s5-homeserver-online-check-fixes
git switch main
git merge --squash l1s5-homeserver-online-check-fixes
git switch main
git merge --ff-only l1s5-homeserver-online-check-fixes
git switch main
git merge l1s5-homeserver-online-check-fixes
git push origin main
Sign in to join this conversation.
No description provided.