Merge pull request 'Announce only on the subjects the grants allow (hq ADR 0197, issue 217)' (#40) from fix/announce-only-what-the-grants-allow into main
This commit was merged in pull request #40.
This commit is contained in:
@@ -158,7 +158,9 @@ func Serve(conn *bus.Conn, s Service, current func() []Endpoint) (func(), error)
|
|||||||
}
|
}
|
||||||
var stops []func()
|
var stops []func()
|
||||||
for _, verb := range []string{"PING", "INFO", "STATS"} {
|
for _, verb := range []string{"PING", "INFO", "STATS"} {
|
||||||
for _, subject := range []string{"$SRV." + verb, "$SRV." + verb + ".>"} {
|
// Exactly the questions asked of every service and of this one by name and instance — what the
|
||||||
|
// grants allow (novox/hq ADR 0197). A wildcard is refused by the bus.
|
||||||
|
for _, subject := range []string{"$SRV." + verb, "$SRV." + verb + "." + s.Name, "$SRV." + verb + "." + s.Name + "." + s.ID} {
|
||||||
stop, err := conn.Raw(subject, answer)
|
stop, err := conn.Raw(subject, answer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
for _, st := range stops {
|
for _, st := range stops {
|
||||||
|
|||||||
@@ -127,8 +127,13 @@ export function announce(broker: RuntimeBroker, s: Service, current: () => Endpo
|
|||||||
return sc.encode(JSON.stringify(v));
|
return sc.encode(JSON.stringify(v));
|
||||||
};
|
};
|
||||||
const stops: (() => void)[] = [];
|
const stops: (() => void)[] = [];
|
||||||
|
// Exactly the questions asked of every service and of this one by name and instance — what the
|
||||||
|
// grants allow (novox/hq ADR 0197). A wildcard is refused by the bus, and a refused subscription
|
||||||
|
// ends a runtime: on 2026-10-03 it crash-looped every container that announced itself.
|
||||||
for (const verb of ["PING", "INFO", "STATS"]) {
|
for (const verb of ["PING", "INFO", "STATS"]) {
|
||||||
for (const subject of [`$SRV.${verb}`, `$SRV.${verb}.>`]) stops.push(broker.raw!(subject, (subj) => answer(subj)));
|
for (const subject of [`$SRV.${verb}`, `$SRV.${verb}.${s.name}`, `$SRV.${verb}.${s.name}.${s.id}`]) {
|
||||||
|
stops.push(broker.raw!(subject, (subj) => answer(subj)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return () => stops.forEach((stop) => stop());
|
return () => stops.forEach((stop) => stop());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user