Skip to content

Commit

Permalink
Fix race condition in TestFileStoreAgeLimitRecovery
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Jul 26, 2023
1 parent 4d8d019 commit 544e4c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/filestore.go
Expand Up @@ -419,8 +419,11 @@ func newFileStoreWithCreated(fcfg FileStoreConfig, cfg StreamConfig, created tim
// If the stream has an initial sequence number then make sure we
// have purged up until that point. We will do this only if the
// recovered first sequence number is before our configured first
// sequence.
// sequence. Need to do this locked as by now the age check timer
// has started.
fs.mu.RLock()
fs.FastState(&fs.state)
fs.mu.RUnlock()
if cfg.FirstSeq > 0 && fs.state.FirstSeq <= cfg.FirstSeq {
if _, err := fs.purge(cfg.FirstSeq); err != nil {
return nil, err
Expand Down

0 comments on commit 544e4c2

Please sign in to comment.