Skip to content

Commit b1e41f5

Browse files
authored
pkg/utils: fix SleeperTask race (#1737)
1 parent debc92f commit b1e41f5

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

pkg/utils/sleeper_task.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package utils
22

33
import (
44
"context"
5-
"fmt"
6-
"time"
75

86
"github.com/smartcontractkit/chainlink-common/pkg/services"
97
)
@@ -70,11 +68,7 @@ func NewSleeperTaskCtx(w WorkerCtx) *SleeperTask {
7068
func (s *SleeperTask) Stop() error {
7169
return s.StopOnce("SleeperTask-"+s.worker.Name(), func() error {
7270
close(s.chStop)
73-
select {
74-
case <-s.chDone:
75-
case <-time.After(15 * time.Second):
76-
return fmt.Errorf("SleeperTask-%s took too long to stop", s.worker.Name())
77-
}
71+
<-s.chDone
7872
return nil
7973
})
8074
}

0 commit comments

Comments
 (0)