Skip to content

Commit

Permalink
Fix race condition when recreating subs
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Twigg <[email protected]>
  • Loading branch information
neilalexander committed Aug 7, 2024
1 parent d8be553 commit ab9ed39
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,14 @@ func (n *raft) recreateInternalSubsLocked() error {
acc := n.s.accountNRGAllowed.Load()
if acc {
// Check whether the specific account has account NRG enabled.
if a, _ := n.s.lookupAccount(n.accName); a != nil && a.js != nil {
acc = a.js.accountNRG.Load()
if a, _ := n.s.lookupAccount(n.accName); a != nil {
a.mu.RLock()
ajs := a.js
a.mu.RUnlock()
// Check whether the specific account has JetStream enabled.
if ajs != nil {
acc = ajs.accountNRG.Load()
}
}
}
if acc {
Expand Down

0 comments on commit ab9ed39

Please sign in to comment.