Watch
0
0
Fork
You've already forked hyperhive
0

swarm-nats-auth: let the notify router read its own consumer's counts, which its lag gauges ask for

This commit is contained in:
damocles 2026-11-05 10:48:50 +01:00 • committed by mara
commit f64d2151d0

View file

@ -282,9 +282,10 @@ impl Policy {
///
/// - **Forge events.** Open or create the stream, create its one durable
/// in the extended form whose last tokens are the filter (the server
/// checks them against the payload), pull from it and ack. No bare
/// `CONSUMER.CREATE`, no `CONSUMER.INFO`, no publish on the events: the
/// controller is their one publisher.
/// checks them against the payload), pull from it and ack, and read its
/// own consumer's counts with `CONSUMER.INFO` for the lag gauges. No bare
/// `CONSUMER.CREATE`, no `CONSUMER.INFO` on any other consumer, no
/// publish on the events: the controller is their one publisher.
/// - **Todo queue.** Open or create `ROUTER_TODOS` and publish on every
/// agent's subject: one per agent, so a wildcard, for the no-roster
/// reason the reader's input grant gives. No other grant names these
@ -321,6 +322,7 @@ impl Policy {
forge_events::subject_wildcard()
),
format!("$JS.API.CONSUMER.MSG.NEXT.{events}.{consumer}"),
format!("$JS.API.CONSUMER.INFO.{events}.{consumer}"),
format!("$JS.ACK.{events}.{consumer}.>"),
format!("$JS.API.STREAM.INFO.{}", router_todo::STREAM),
format!("$JS.API.STREAM.CREATE.{}", router_todo::STREAM),
@ -1927,6 +1929,8 @@ mod tests {
forge_events::subject_wildcard()
),
format!("$JS.API.CONSUMER.MSG.NEXT.{events}.notify-router"),
// Its own consumer's counts, for the lag gauges.
format!("$JS.API.CONSUMER.INFO.{events}.notify-router"),
format!("$JS.ACK.{events}.notify-router.1.5.5.1700000000.0"),
format!("$JS.API.STREAM.INFO.{events}"),
format!("$JS.API.STREAM.CREATE.{}", router_todo::STREAM),
@ -1956,6 +1960,8 @@ mod tests {
format!("$JS.API.CONSUMER.CREATE.{events}"),
format!("$JS.API.CONSUMER.CREATE.{events}.other.$SWARM.events.forge.*"),
format!("$JS.API.CONSUMER.DELETE.{events}.notify-router"),
// Only its own consumer's counts, not another's.
format!("$JS.API.CONSUMER.INFO.{events}.other"),
format!("$JS.API.STREAM.DELETE.{}", router_todo::STREAM),
format!("$JS.API.STREAM.UPDATE.{}", router_todo::STREAM),
format!(