From b80f8b26b1a7d3d1974c77e92515ba8a650bfe45 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Mon, 22 Jun 2020 21:34:30 +0100 Subject: don't rebroadcast deleted topics --- catbus/catbus.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/catbus/catbus.go b/catbus/catbus.go index 9325d8e..a76e644 100644 --- a/catbus/catbus.go +++ b/catbus/catbus.go @@ -127,6 +127,12 @@ func (c *Client) rebroadcastLater(topic string, retention Retention, payload []b if timer := c.rebroadcastByTopic[topic]; timer != nil { _ = timer.Stop() } + + if len(payload) == 0 { + // No payload => remove => don't rebroadcast. + return + } + c.rebroadcastByTopic[topic] = time.AfterFunc(c.rebroadcastDuration(), func() { _ = c.Publish(topic, retention, payload) }) -- cgit v1.2.3