Skip to content

Commit

Permalink
Fix for segfault if mset.mirror was nil when calculating last
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison authored and wallyqs committed Jun 11, 2024
1 parent b8b51f3 commit 407aa16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2191,9 +2191,11 @@ func (mset *stream) processMirrorMsgs(mirror *sourceInfo, ready *sync.WaitGroup)
msgs.recycle(&ims)
case <-t.C:
mset.mu.RLock()
var stalled bool
if mset.mirror != nil {
stalled = time.Since(time.Unix(0, mset.mirror.last.Load())) > sourceHealthCheckInterval
}
isLeader := mset.isLeader()
last := time.Unix(0, mset.mirror.last.Load())
stalled := mset.mirror != nil && time.Since(last) > sourceHealthCheckInterval
mset.mu.RUnlock()
// No longer leader.
if !isLeader {
Expand Down

0 comments on commit 407aa16

Please sign in to comment.