mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Proposer timer handling when the context is cancelled in random peer
This commit is contained in:
@@ -1133,9 +1133,14 @@ func randomPeer(
|
||||
"delay": waitPeriod,
|
||||
}).Debug("Waiting for a peer with enough bandwidth for data column sidecars")
|
||||
|
||||
timer := time.NewTimer(waitPeriod)
|
||||
select {
|
||||
case <-time.After(waitPeriod):
|
||||
case <-timer.C:
|
||||
// Timer expired, retry the loop
|
||||
case <-ctx.Done():
|
||||
// Context cancelled - stop timer to prevent leak
|
||||
timer.Stop()
|
||||
return "", ctx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
changelog/ttsao_fix-timer.md
Normal file
3
changelog/ttsao_fix-timer.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
|
||||
- Replace `time.After()` with `time.NewTimer()` and explicitly stop the timer when the context is cancelled
|
||||
Reference in New Issue
Block a user