Сервисы
Сервисы
Projector
Builds and serves the shared Valkey read models: settings, live state and live counters.
Эта страница ещё не переведена, поэтому показана английская версия.
The Projector service (app/projector/) folds data-owner events into shared Valkey read models and serves cache-oriented reads. Consumer services (primarily Sesame) use them for high-throughput reads.
Architecture
Instead of having high-traffic consumer workers execute SQL queries against the various data services (Users, Modules, Commands), the Projector constructs flattened read-models.
- Folds: Users, Commands and Modules publish
data.users.changed,data.users.deleted,data.modules.changedanddata.commands.changed. The Projector consumes them, writes the Valkey projection, then broadcasts a cache invalidation onbagel.cache.invalidate.<scope>(for examplestatus,modules,commands,live) so every process cache drops its copy. - Stream lifecycle: When a stream comes online (
twitch.ingress.event.stream), the Projector records the live state, then warms the full projection in the background. - Hydration: A cold read calls the owning service over
bagel.rpc.internal.projection.*and returns that section. Missing sections are filled in the background. - Reads: It serves
bagel.rpc.broadcaster.status.get,bagel.rpc.broadcaster.live.get,bagel.rpc.broadcaster.stream_info.get, and the dashboard reads underbagel.rpc.projector.dashboard.*. - Live counters: It folds
data.loyalty.countersbumps into live bot and channel totals and seeds ranked boards from Loyalty.
By isolating the read load into a dedicated projection in Valkey, the actual MySQL databases for configuration are shielded from the massive read volume generated by active Twitch chats.