From 3b29ce470dc3e4a39ed1c982a74795fa1ee7a2eb Mon Sep 17 00:00:00 2001 From: Neil Twigg Date: Thu, 12 Jan 2023 17:32:46 +0000 Subject: [PATCH] Tweak logic for sending leaf node subscription updates --- server/leafnode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/leafnode.go b/server/leafnode.go index 89acd7f7..9a5b7639 100644 --- a/server/leafnode.go +++ b/server/leafnode.go @@ -1857,7 +1857,7 @@ func (c *client) updateSmap(sub *subscription, delta int32) { n := c.leaf.smap[key] // We will update if its a queue, if count is zero (or negative), or we were 0 and are N > 0. - update := sub.queue != nil || n == 0 || n+delta <= 0 + update := sub.queue != nil || (n <= 0 && n+delta > 0) || (n > 0 && n+delta <= 0) n += delta if n > 0 { c.leaf.smap[key] = n