diff --git a/go.mod b/go.mod index b188fd502..270541208 100644 --- a/go.mod +++ b/go.mod @@ -82,7 +82,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.10.0 github.com/test-go/testify v1.1.4 - github.com/thejerf/suture/v4 v4.0.5 + github.com/thejerf/suture/v4 v4.0.6 github.com/tidwall/gjson v1.18.0 github.com/tus/tusd/v2 v2.6.0 github.com/unrolled/secure v1.16.0 diff --git a/go.sum b/go.sum index 09281add4..16b8b6f39 100644 --- a/go.sum +++ b/go.sum @@ -1086,8 +1086,8 @@ github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/thanhpk/randstr v1.0.6 h1:psAOktJFD4vV9NEVb3qkhRSMvYh4ORRaj1+w/hn4B+o= github.com/thanhpk/randstr v1.0.6/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= -github.com/thejerf/suture/v4 v4.0.5 h1:F1E/4FZwXWqvlWDKEUo6/ndLtxGAUzMmNqkrMknZbAA= -github.com/thejerf/suture/v4 v4.0.5/go.mod h1:gu9Y4dXNUWFrByqRt30Rm9/UZ0wzRSt9AJS6xu/ZGxU= +github.com/thejerf/suture/v4 v4.0.6 h1:QsuCEsCqb03xF9tPAsWAj8QOAJBgQI1c0VqJNaingg8= +github.com/thejerf/suture/v4 v4.0.6/go.mod h1:gu9Y4dXNUWFrByqRt30Rm9/UZ0wzRSt9AJS6xu/ZGxU= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= diff --git a/vendor/github.com/thejerf/suture/v4/supervisor.go b/vendor/github.com/thejerf/suture/v4/supervisor.go index 0ab5f99d2..585bf1637 100644 --- a/vendor/github.com/thejerf/suture/v4/supervisor.go +++ b/vendor/github.com/thejerf/suture/v4/supervisor.go @@ -120,10 +120,8 @@ following: exits it - When a service fails to stop -A slog-based EventHook is provided in the submodule sutureslog. Note -that it is a separate Go module, in order to avoid imposing a Go 1.21 -requirement on this module, so a separate go get step will be -necessary to use it. +A default hook for slog is provided with the [sutureslog +module](https://github.com/thejerf/sutureslog). The failureRate, failureThreshold, and failureBackoff controls how failures are handled, in order to avoid the supervisor failure case where the @@ -365,7 +363,8 @@ func (s *Supervisor) Serve(ctx context.Context) error { _, monitored := s.services[msg.id] if monitored { cancel := s.cancellations[msg.id] - if isErr(msg.err, ErrDoNotRestart) || isErr(msg.err, context.Canceled) || isErr(msg.err, context.DeadlineExceeded) { + + if isErr(msg.err, ErrDoNotRestart) || ctx.Err() != nil { delete(s.services, msg.id) delete(s.cancellations, msg.id) go cancel() @@ -377,7 +376,11 @@ func (s *Supervisor) Serve(ctx context.Context) error { return msg.err } } else { - s.handleFailedService(ctx, msg.id, msg.err, nil, false) + err := msg.err + if isErr(msg.err, context.DeadlineExceeded) || isErr(msg.err, context.Canceled) { + err = fmt.Errorf("from some other context, not the service's context, so service is being restarted: %w", msg.err) + } + s.handleFailedService(ctx, msg.id, err, nil, false) } } case addService: diff --git a/vendor/modules.txt b/vendor/modules.txt index 4b8ac2e34..d5d0f4e7f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1822,7 +1822,7 @@ github.com/tchap/go-patricia/v2/patricia # github.com/test-go/testify v1.1.4 ## explicit github.com/test-go/testify/require -# github.com/thejerf/suture/v4 v4.0.5 +# github.com/thejerf/suture/v4 v4.0.6 ## explicit; go 1.9 github.com/thejerf/suture/v4 # github.com/tidwall/gjson v1.18.0