Skip to content

Commit

Permalink
fix worker stop
Browse files Browse the repository at this point in the history
  • Loading branch information
zc2638 committed Jan 12, 2024
1 parent ccd83fc commit caf0eee
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,17 @@ func (w *Worker) Run(ctx context.Context) error {
"wait", waitTimes,
)

select {
case <-wCtx.Done():
return err
default:
}

waitSec := math.Pow(2, float64(waitTimes))
if waitSec > 60 {
waitSec = constant.DefaultWaitTime
}
waitTimes++
time.Sleep(time.Second * time.Duration(waitSec))

select {
case <-time.After(time.Second * time.Duration(waitSec)):
case <-wCtx.Done():
return err
}
continue
}
waitTimes = 0
Expand Down

0 comments on commit caf0eee

Please sign in to comment.