File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -598,18 +598,22 @@ func (bq *baseQueue) Async(
598
598
log .InfofDepth (ctx , 2 , "%s" , redact .Safe (opName ))
599
599
}
600
600
opName += " (" + bq .name + ")"
601
- bgCtx := bq .AnnotateCtx (context .Background ())
602
- if err := bq .store .stopper .RunAsyncTaskEx (bgCtx ,
603
- stop.TaskOpts {
601
+ bgCtx , hdl , err := bq .store .stopper .GetHandle (
602
+ bq .AnnotateCtx (context .Background ()), stop.TaskOpts {
604
603
TaskName : opName ,
605
604
Sem : bq .addOrMaybeAddSem ,
606
605
WaitForSem : wait ,
607
- },
608
- func (ctx context.Context ) {
609
- fn (ctx , baseQueueHelper {bq })
610
- }); err != nil && bq .addLogN .ShouldLog () {
611
- log .Infof (ctx , "rate limited in %s: %s" , redact .Safe (opName ), err )
606
+ })
607
+ if err != nil {
608
+ if bq .addLogN .ShouldLog () {
609
+ log .Infof (ctx , "rate limited in %s: %s" , redact .Safe (opName ), err )
610
+ }
611
+ return
612
612
}
613
+ go func (ctx context.Context ) {
614
+ defer hdl .Activate (ctx ).Release (ctx )
615
+ fn (ctx , baseQueueHelper {bq })
616
+ }(bgCtx )
613
617
}
614
618
615
619
// MaybeAddAsync offers the replica to the queue. The queue will only process a
You can’t perform that action at this time.
0 commit comments