mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-01-09 01:19:05 +00:00
services: fix defer function in retry
of NeoFSBlockFetcher
Drain the channel only if it has pending events. This avoids trying to read from an already-empty channel. Close #3734 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
5f92da21fa
commit
3010324c4f
1 changed files with 4 additions and 1 deletions
|
@ -518,7 +518,10 @@ func (bfs *Service) retry(action func() error) error {
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
if !timer.Stop() {
|
if !timer.Stop() {
|
||||||
<-timer.C
|
select {
|
||||||
|
case <-timer.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue