We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb5f178 commit 96ffc09Copy full SHA for 96ffc09
cmd/kar-controllers/app/server.go
@@ -71,13 +71,22 @@ func Run(ctx context.Context, opt *options.ServerOption) error {
71
}
72
73
stopCh := make(chan struct{})
74
+ // this channel is used to signal that the job controller is done
75
+ jobctrlDoneCh := make(chan struct{})
76
77
go func() {
78
defer close(stopCh)
79
<-ctx.Done()
80
}()
81
- go jobctrl.Run(stopCh)
82
+ go func() {
83
+ jobctrl.Run(stopCh)
84
+ // close the jobctrlDoneCh channel when the job controller is done
85
+ close(jobctrlDoneCh)
86
+ }()
87
+
88
+ // wait for the job controller to be done before shutting down the server
89
+ <-jobctrlDoneCh
90
91
err = startHealthAndMetricsServers(ctx, opt)
92
if err != nil {
0 commit comments