Worker graceful shutdown (#2455)

* add graceful shutdown to worker
This commit is contained in:
Irena Rindos authored and GitHub committed 2022-09-19 09:59:18 -04:00
1 parent a2ef14283b
commit d951e1ebc1
16 files changed
+241 -229

No files matched your search

+6 -3
View File
@@ -287,7 +287,7 @@ func (tc *TestController) buildClient() {
func (tc *TestController) Shutdown() {
tc.shutdownOnce.Do(func() {
if tc.b != nil {
close(tc.b.ShutdownCh)
tc.b.ContextCancel()
}
tc.cancel()
@@ -492,10 +492,13 @@ func TestControllerConfig(t testing.TB, ctx context.Context, tc *TestController,
opts = new(TestControllerOpts)
}
ctxTest, cancel := context.WithCancel(context.Background())
// Base server
tc.b = base.NewServer(&base.Command{
Context: ctx,
ShutdownCh: make(chan struct{}),
Context: ctxTest,
ContextCancel: cancel,
ShutdownCh: make(chan struct{}),
})
// Get dev config, or use a provided one