fix: shutdown on error
This commit is contained in:
parent
7725019ed7
commit
b1cc2af8d8
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module go.sour.is/pkg
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/99designs/gqlgen v0.17.34
|
||||
|
|
|
@ -71,7 +71,7 @@ func (w wrapSpan) AddEvent(name string, options ...trace.EventOption) {
|
|||
args[2*i+1] = a.Value
|
||||
}
|
||||
|
||||
slog.Info(name, args...)
|
||||
slog.Debug(name, args...)
|
||||
}
|
||||
|
||||
func (w wrapSpan) RecordError(err error, options ...trace.EventOption) {
|
||||
|
@ -142,7 +142,7 @@ func initTracing(ctx context.Context, name string) (context.Context, func() erro
|
|||
return ctx, nil
|
||||
}
|
||||
|
||||
exporterAddr := env.Default("EV_TRACE_ENDPOINT", "")
|
||||
exporterAddr := env.Default("TRACE_ENDPOINT", "")
|
||||
if exporterAddr == "" {
|
||||
return ctx, nil
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user