apps/
Flush worker
BullMQ worker that flushes Redis room state to durable Prisma snapshots.
The worker reads each dirty snapshot, inserts a new scene revision only when the database is behind, and retains the latest revisions. It touches nothing live: presence and previews never pass through here, so a room can be busy without ever being flushed mid-thought — the debounce decides when a snapshot is durable.
What it owns
- Scheduled flushes of dirty rooms from Redis to Postgres
- Recovery sweeps that re-schedule anything left dirty
- Room message and memory metrics logging
Files
File list and purposes from the folder README.
| File | Purpose |
|---|---|
src/index.ts | Worker entry, flush callback, timers, and shutdown. |
package.json | Workspace scripts and dependencies. |
tsconfig.json | TypeScript config. |
Dependencies
No runtime dependencies.
Development and tooling (3)
| Library | Version range | Why it is used here |
|---|---|---|
| @types/node | 26.4.1 | Type declarations for Node.js built-ins. |
| tsx | ^4.23.13 | Runs and watches TypeScript sources for development and tests. |
| TypeScript | 7.0.2 | Compiles the workspace and type-checks every package. |
Dependencies as of commit b0026d9.
Internal packages used
Laying out flush-worker folder…
BrowserAPIRealtimeCacheDatabaseShareddurableephemeral
Talks to
Sources: apps/flush-worker/README.md, apps/flush-worker/src/README.md, apps/flush-worker/src/index.ts (documented at commit b0026d9)