diff options
Diffstat (limited to '')
-rw-r--r-- | catbus/catbus.go | 6 |
1 files changed, 6 insertions, 0 deletions
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) }) |