diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-06-22 21:34:30 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-06-22 21:34:30 +0100 |
commit | b80f8b26b1a7d3d1974c77e92515ba8a650bfe45 (patch) | |
tree | 587876dc9d96a56615cb4b3bb0510538aa452aae /catbus/catbus.go | |
parent | b9f13df51979ff38e4a9578f982cc608e3bb2c0d (diff) |
don't rebroadcast deleted topics
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) }) |