Skip to content

Commit

Permalink
De-flake TestJetStreamClusterMirrorAndSourceExpiration (#6304)
Browse files Browse the repository at this point in the history
`nextTTL` was not defaulted to `math.MaxInt64` so it would not cancel
the age check in this condition: `if fs.state.Msgs == 0 && nextTTL ==
math.MaxInt64`.

Signed-off-by: Maurice van Veen <[email protected]>
  • Loading branch information
derekcollison authored Dec 27, 2024
2 parents 1a0d55f + 39b7bd1 commit cee44be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5317,7 +5317,7 @@ func (fs *fileStore) expireMsgs() {
defer fs.mu.Unlock()

// TODO: Not great that we're holding the lock here, but the timed hash wheel isn't thread-safe.
var nextTTL int64
nextTTL := int64(math.MaxInt64)
if fs.ttls != nil {
fs.ttls.ExpireTasks(func(seq uint64, ts int64) {
fs.removeMsgViaLimits(seq)
Expand All @@ -5331,7 +5331,7 @@ func (fs *fileStore) expireMsgs() {
}
}

// Onky cancel if no message left, not on potential lookup error that would result in sm == nil.
// Only cancel if no message left, not on potential lookup error that would result in sm == nil.
if fs.state.Msgs == 0 && nextTTL == math.MaxInt64 {
fs.cancelAgeChk()
} else {
Expand Down

0 comments on commit cee44be

Please sign in to comment.