fix: shutdown on error
Go Bump / bump (push) Successful in 35s Details
Go Test / build (push) Successful in 40s Details

grug-math v0.0.6
xuu 2023-10-19 16:52:55 -06:00
parent 7725019ed7
commit b1cc2af8d8
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
3 changed files with 7 additions and 4 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module go.sour.is/pkg
go 1.20
go 1.21
require (
github.com/99designs/gqlgen v0.17.34

View File

@ -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
}

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
}