diff --git a/go.mod b/go.mod index 57733da7b1..02c94cfbef 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/nats-io/nats-server/v2 v2.14.0 github.com/nats-io/nats.go v1.51.0 - github.com/oklog/run v1.2.0 github.com/olekukonko/tablewriter v1.1.4 github.com/onsi/ginkgo v1.16.5 github.com/onsi/ginkgo/v2 v2.28.3 @@ -308,6 +307,7 @@ require ( github.com/nats-io/nkeys v0.4.15 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/nxadm/tail v1.4.8 // indirect + github.com/oklog/run v1.2.0 // indirect github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect github.com/olekukonko/errors v1.2.0 // indirect github.com/olekukonko/ll v0.1.6 // indirect diff --git a/services/activitylog/pkg/command/server.go b/services/activitylog/pkg/command/server.go index 8f95d481f9..10533fa9a5 100644 --- a/services/activitylog/pkg/command/server.go +++ b/services/activitylog/pkg/command/server.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/oklog/run" "github.com/opencloud-eu/opencloud/pkg/log" + "github.com/opencloud-eu/opencloud/pkg/runner" "github.com/opencloud-eu/reva/v2/pkg/events" "github.com/opencloud-eu/reva/v2/pkg/events/stream" "github.com/opencloud-eu/reva/v2/pkg/rgrpc/todo/pool" @@ -62,7 +62,7 @@ func Server(cfg *config.Config) *cobra.Command { return err } - gr := run.Group{} + gr := runner.NewGroup() ctx, cancel := context.WithCancel(cmd.Context()) mtrcs := metrics.New() @@ -132,23 +132,7 @@ func Server(cfg *config.Config) *cobra.Command { return err } - gr.Add(func() error { - return svc.Run() - }, func(err error) { - if err == nil { - logger.Info(). - Str("transport", "http"). - Str("server", cfg.Service.Name). - Msg("Shutting down server") - } else { - logger.Error().Err(err). - Str("transport", "http"). - Str("server", cfg.Service.Name). - Msg("Shutting down server") - } - - cancel() - }) + gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", svc)) } { @@ -162,13 +146,18 @@ func Server(cfg *config.Config) *cobra.Command { return err } - gr.Add(debugServer.ListenAndServe, func(_ error) { - _ = debugServer.Shutdown(ctx) - cancel() - }) + gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer)) } - return gr.Run() + grResults := gr.Run(ctx) + + // return the first non-nil error found in the results + for _, grResult := range grResults { + if grResult.RunnerError != nil { + return grResult.RunnerError + } + } + return nil }, } }