Skip to content

Commit

Permalink
prevent crash during timer expiration after stream is closed
Browse files Browse the repository at this point in the history
Reorder ticker stop and close merge to prevent send(true) happens after merge is closed, in rare situation when the timer expires exactly at the point between close(merge) and ticker.Stop()

Signed-off-by: morapet <[email protected]>
  • Loading branch information
morapet committed Sep 16, 2024
1 parent f22c332 commit a02d12c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/application/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func mergeLogStreams(streams []chan logEntry, bufferingDuration time.Duration) c

_ = send(true)

close(merged)
ticker.Stop()
close(merged)
}()
return merged
}

0 comments on commit a02d12c

Please sign in to comment.