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