fix: shutdown on error
All checks were successful
Go Bump / bump (push) Successful in 35s
Go Test / build (push) Successful in 40s

This commit is contained in:
xuu
2023-10-19 16:52:55 -06:00
parent 7725019ed7
commit b1cc2af8d8
3 changed files with 7 additions and 4 deletions

View File

@@ -93,7 +93,7 @@ func (s *Harness) Run(ctx context.Context, appName, version string) error {
span.End()
}
g, _ := errgroup.WithContext(ctx)
g, ctx := errgroup.WithContext(ctx)
g.Go(func() error {
<-ctx.Done()
// shutdown jobs
@@ -111,7 +111,10 @@ func (s *Harness) Run(ctx context.Context, appName, version string) error {
close(s.onRunning)
err := g.Wait()
if err != nil {
log.Printf("Shutdown due to error: %s", err)
}
return err
}