Ir para o conteúdo

Serviços

Projector

Builds and serves the shared Valkey read models: settings, live state and live counters.

Esta página ainda não foi traduzida, então você está lendo a versão em inglês.

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.changed and data.commands.changed. The Projector consumes them, writes the Valkey projection, then broadcasts a cache invalidation on bagel.cache.invalidate.<scope> (for example status, 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 under bagel.rpc.projector.dashboard.*.
  • Live counters: It folds data.loyalty.counters bumps 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.