Repository navigation
Commit 3a5d0d1
authored
feat(host): push channel lifecycle through project lobbies (#337)
* feat(host): push channel lifecycle through project lobbies
After each successful publish to the directory, a host diffs its channels
against its previous publication and sends each change (created, renamed,
summarized, archived, resumed, moved, deleted, or a run's end, with the new
listing) to that project's lobby. Each stays queued, latest per channel, until
the lobby echoes it back, and is resent after a reconnect, since a socket can
die unnoticed. A lobby the host no longer needs stays until the next
publication, so a project's last deletion still reaches it.
Teammates' hosts apply events to their directory listings at once and rebuild
listings once per burst, so a replay of thousands of events reads catalogs a
few times, not per event; a directory read already in flight reapplies them,
and a resync reads the directory again.
While every project a host subscribes to has a live lobby and its last publish
succeeded, the 30 s directory poll slows to a 5 min read; changes still
publish immediately, and a change that arrives during a sync runs another.
Activity alone sends no event and reaches teammates through peers or that
read. Without lobbies the poll stays at 30 s. Refs #17, #14.
Why: apps/host/src/lobby.ts#function published | events must be sent only after the directory PUT succeeds, so a teammate that reads the directory on receipt agrees with the event
Why: apps/host/src/directory.ts#function watch | the poll may slow only while every subscribed project's lobby is live and the last publish succeeded; a 404, dropped lobby, or failed PUT must keep the 30 s poll
Why: apps/host/src/directory.ts#function apply | a directory read that started before a lifecycle event must reapply it, or the stale read undoes the push
Why: apps/host/src/lobby.ts#function receive | this host's events stay queued until the lobby echoes them (same channel and at), since a socket can die unnoticed for up to SILENT
Why: apps/host/src/lobby.ts#function update | a lobby no longer wanted must stay until the next publication, or a project's last deletion is never sent
Why: apps/host/src/lobby.ts#function listed | teammates' events rebuild listings once per burst; a replay must never re-read catalogs per event
* lane: sync lobby-lifecycle memory
* lane: sync lobby-lifecycle memory
* lane: sync lobby-lifecycle memory
* lane: sync lobby-lifecycle memory
* lane: sync lobby-lifecycle memory
* lane: sync lobby-lifecycle memory1 parent 812a8fc commit 3a5d0d1
16 files changed
Lines changed: 328 additions & 62 deletions
File tree
- .lane
- attic/apps/host/src/directory.ts
- memory/apps/host/src
- directory.ts
- gateway.ts
- lobby.ts
- apps/host/src
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments