Skip to content

Commit

Permalink
meterer: Do not wait for stopped timer.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGruffins authored and chappjc committed Feb 22, 2023
1 parent ef84b8e commit 13d1988
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dex/meter/meterer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// DelayedRelay creates a simple error signal pipeline that delays and
// aggregates the relaying of nil errors. Non-nil errors received on the in
// channel are immediately send on the out channel without delay. If a nil error
// channel are immediately sent on the out channel without delay. If a nil error
// arrives within minDelay of the previous one, it will be scheduled for later
// to respect the configured delay. If multiple arrive within minDelay, they
// will be grouped into a single delayed signal.
Expand Down Expand Up @@ -54,8 +54,8 @@ func DelayedRelay(ctx context.Context, minDelay time.Duration, n int) (out <-cha
last = time.Now().UTC()

case <-ctx.Done():
if scheduled != nil && !scheduled.Stop() {
<-scheduled.C
if scheduled != nil {
scheduled.Stop()
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion server/swap/swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ func (s *Swapper) Run(ctx context.Context) {
return
}
select {
case <-mainLoop:
case <-ctxHelpers.Done():
return
case blockNotes <- &blockNotification{
time: time.Now().UTC(),
Expand Down

0 comments on commit 13d1988

Please sign in to comment.