Issue a verified sender again only over the membership that was read, so a newer push is not overwritten (issue 930)
mesh/merge-gate head 87410d79edd6 merged into trunk e231185572ba — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 87410d79edd6 merged into trunk e231185572ba — pass: its merge-check.sh passed
mesh/delivery delivered

This commit is contained in:
2026-10-16 17:46:18 +02:00
parent 1c3c3edc7d
commit 87410d79ed
3 changed files with 65 additions and 14 deletions
+13
View File
@@ -179,6 +179,19 @@ func (b OverNATS) PublishMembership(ctx context.Context, node, module string, bo
return nil
}
// PublishMembershipAfter issues a membership only if the one read at sequence seq is still the newest of its
// subject: a push that issued another since is not overwritten, and the refusal comes back (novox/hq issue 930).
func (b OverNATS) PublishMembershipAfter(ctx context.Context, node, module string, body []byte, seq uint64) error {
ctx, cancel := context.WithTimeout(ctx, MembershipWait)
defer cancel()
_, err := b.JS.Publish(broker.MembershipSubject(node, module), body, nats.Context(ctx),
nats.ExpectLastSequencePerSubject(seq))
if err != nil {
return fmt.Errorf("issuing %s on %s its membership after sequence %d: %w", module, node, seq, err)
}
return nil
}
func (b OverNATS) PublishDeclaration(ctx context.Context, node string, body []byte) error {
_, err := b.JS.Publish(DeclareSubject(node), body, nats.Context(ctx))
if err != nil {