Answer each broker request without waiting on the others #6

Merged
natsukium merged 1 commit from fix/concurrent-requests into main 2026-10-14 14:01:44 +09:00
Owner

A roster-wide list waits on its slowest host, and an ssh host whose machine is asleep takes the full 20 s dial timeout to fail. The broker loop ran each request to completion before reading the next message, so for those 20 s every other request queued behind it, including the attach that restores a tab and keystrokes on tabs already open. On a phone, this meant no sessions appeared after reopening the app.

Requests that reach a daemon now run as tasks beside the loop and reply by re when they finish. hosts and detach are still answered inline. An opened stream goes back to the loop to get its sid, and its reply goes out before the relay starts.

  • docs/broker.md now states that replies may arrive out of order, and names hosts as the liveness probe.
  • New test: a host that accepts connections but never answers does not delay a hosts reply. The test fails on main after 5 s.
  • Manual check against a felis 0.2.0 daemon with an unreachable ssh host on the roster: the app (with its matching fix) shows the restored session in 61 ms, down from 20.4 s.
A roster-wide `list` waits on its slowest host, and an ssh host whose machine is asleep takes the full 20 s dial timeout to fail. The broker loop ran each request to completion before reading the next message, so for those 20 s every other request queued behind it, including the attach that restores a tab and keystrokes on tabs already open. On a phone, this meant no sessions appeared after reopening the app. Requests that reach a daemon now run as tasks beside the loop and reply by `re` when they finish. `hosts` and `detach` are still answered inline. An opened stream goes back to the loop to get its `sid`, and its reply goes out before the relay starts. - docs/broker.md now states that replies may arrive out of order, and names `hosts` as the liveness probe. - New test: a host that accepts connections but never answers does not delay a `hosts` reply. The test fails on main after 5 s. - Manual check against a felis 0.2.0 daemon with an unreachable ssh host on the roster: the app (with its matching fix) shows the restored session in 61 ms, down from 20.4 s.
Answer each broker request without waiting on the others
All checks were successful
ci / fmt / clippy / test / deny (pull_request) Successful in 1m34s
bab8319119
The broker loop ran every request to completion before reading the next
message. A roster-wide `list` waits on its slowest host, and an ssh host
whose machine is asleep takes the full dial timeout to fail, so for
twenty seconds the loop held every other request behind it: a phone
reopening the app saw no tabs until the sleeping host gave up, and
keystrokes on already-open tabs queued up too.

Requests that reach a daemon (`list`, `destroy`, `tag`, and the dial of
an `attach`/`create`) now run as tasks beside the loop and reply by
`re` when they finish, so replies may arrive out of order; `hosts` and
`detach` are still answered inline from the gateway's own state. An
opened stream returns to the loop for its `sid`, which only the loop
hands out, and its reply is sent before the relay starts so a client
has the `sid` routed before the first frame carrying it.

The broker doc now names `hosts` as the liveness probe, since a `list`
probe is held by the same sleeping host and condemns a healthy socket.

Assisted-by: Claude Code
natsukium deleted branch fix/concurrent-requests 2026-10-14 14:01:44 +09:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/felis-web-gateway!6
No description provided.