Skip to content

Commit

Permalink
No longer need to manually delete last message on replace
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Jun 9, 2023
1 parent 8f84574 commit f7380de
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions server/mqtt.go
Expand Up @@ -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
Expand Down

0 comments on commit f7380de

Please sign in to comment.