No longer need to manually delete last message on replace

Signed-off-by: Neil Twigg <neil@nats.io>
This commit is contained in:
Neil Twigg
2023-06-09 13:52:26 +01:00
parent a5c0711488
commit 3fef0edd76

View File

@@ -3219,11 +3219,7 @@ func (c *client) mqttHandlePubRetain() {
sseq: smr.Sequence,
}
// Add/update the map
oldSeq := asm.handleRetainedMsg(key, rf)
// If this is a new message on the same subject, delete the old one.
if oldSeq != 0 {
asm.deleteRetainedMsg(oldSeq)
}
asm.handleRetainedMsg(key, rf)
} else {
c.mu.Lock()
acc := c.acc