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:
Ekaterina Pavlova 2024-12-08 00:04:14 +03:00
parent 5f92da21fa
commit 3010324c4f

View file

@ -518,7 +518,10 @@ func (bfs *Service) retry(action func() error) error {
)
defer func() {
if !timer.Stop() {
<-timer.C
select {
case <-timer.C:
default:
}
}
}()