@@ -593,21 +593,18 @@ type durCount struct {
593
593
}
594
594
595
595
type supervisor struct {
596
- ctx context.Context
597
- cancelFunc context.CancelFunc
598
- mu sync.Mutex // Guards all maps
599
- cond sync.Cond // Wraps mu so callers can wait until all calls end
600
- running map [callInfo ]timeCount
601
- ran map [callType ]durCount
596
+ ctx context.Context
597
+ mu sync.Mutex // Guards all maps
598
+ cond sync.Cond // Wraps mu so callers can wait until all calls end
599
+ running map [callInfo ]timeCount
600
+ ran map [callType ]durCount
602
601
}
603
602
604
603
func newSupervisor (ctx context.Context ) * supervisor {
605
- ctx , cf := context .WithCancel (ctx )
606
604
supv := & supervisor {
607
- ctx : ctx ,
608
- cancelFunc : cf ,
609
- running : make (map [callInfo ]timeCount ),
610
- ran : make (map [callType ]durCount ),
605
+ ctx : ctx ,
606
+ running : make (map [callInfo ]timeCount ),
607
+ ran : make (map [callType ]durCount ),
611
608
}
612
609
613
610
supv .cond = sync.Cond {L : & supv .mu }
@@ -635,16 +632,12 @@ func (sup *supervisor) do(inctx context.Context, name string, typ callType, f fu
635
632
return err
636
633
}
637
634
638
- func (sup * supervisor ) getLifetimeContext () context.Context {
639
- return sup .ctx
640
- }
641
-
642
635
func (sup * supervisor ) start (ci callInfo ) (context.Context , error ) {
643
636
sup .mu .Lock ()
644
637
defer sup .mu .Unlock ()
645
- if sup .ctx .Err () != nil {
638
+ if err := sup .ctx .Err (); err != nil {
646
639
// We've already been canceled; error out.
647
- return nil , sup . ctx . Err ()
640
+ return nil , err
648
641
}
649
642
650
643
if existingInfo , has := sup .running [ci ]; has {
0 commit comments