set default timeouts and clean up

This commit is contained in:
Roman Perekhod
2025-05-27 13:02:34 +02:00
committed by Jörn Friedrich Dreyer
parent 9a3fc08dd4
commit c597dfb917
40 changed files with 75 additions and 70 deletions

View File

@@ -47,14 +47,14 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr := runner.NewGroup()
gr := runner.NewGroup(runner.Option())
{
svc, err := service.NewAntivirus(cfg, logger, traceProvider)
if err != nil {
return cli.Exit(err.Error(), 1)
}
gr.Add(runner.New("antivirus_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return svc.Run()
}, func() {
svc.Close()
@@ -72,7 +72,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("antivirus_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("app-provider_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("app-registry_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -55,7 +55,7 @@ func Server(cfg *config.Config) *cli.Command {
svcCtx, svcCancel := context.WithCancel(ctx)
defer svcCancel()
gr.Add(runner.New("audit_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
svc.AuditLoggerFromConfig(svcCtx, cfg.Auditlog, evts, logger)
return nil
}, func() {
@@ -73,7 +73,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("audit_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("auth-basic_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("auth-bearer_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("auth-machine_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("auth-service_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -109,7 +109,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.New("clientlog_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return svc.Run()
}, func() {
svc.Close()
@@ -127,7 +127,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("clientlog_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -113,7 +113,7 @@ func Server(cfg *config.Config) *cli.Command {
if err != nil {
return err
}
gr.Add(runner.NewGolangGrpcServerRunner("collaboration_grpc", grpcServer, l))
gr.Add(runner.NewGolangGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer, l))
// start debug server
debugServer, err := debug.Server(
@@ -125,7 +125,7 @@ func Server(cfg *config.Config) *cli.Command {
logger.Error().Err(err).Str("transport", "debug").Msg("Failed to initialize server")
return err
}
gr.Add(runner.NewGolangHttpServerRunner("collaboration_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
// start HTTP server
httpServer, err := http.Server(

View File

@@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
grpc.TraceProvider(traceProvider),
)
gr.Add(runner.NewGoMicroGrpcServerRunner("eventhistory_grpc", service))
gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", service))
{
debugServer, err := debug.Server(
@@ -100,7 +100,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("eventhistory_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -79,7 +79,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("frontend_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
httpSvc := registry.BuildHTTPService(cfg.HTTP.Namespace+"."+cfg.Service.Name, cfg.HTTP.Addr, version.GetString())
@@ -88,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command {
}
// add event handler
gr.Add(runner.New("frontend_event",
gr.Add(runner.New(cfg.Service.Name+".event",
func() error {
return ListenForEvents(ctx, cfg, logger)
}, func() {

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("gateway_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -58,7 +58,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("graph_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -72,7 +72,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("graph_debug", server))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", server))
}
grResults := gr.Run(ctx)

View File

@@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("groups_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -83,7 +83,7 @@ func Server(cfg *config.Config) *cli.Command {
svcCtx, svcCancel := context.WithCancel(ctx)
defer svcCancel()
gr.Add(runner.New("idm_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return svc.Serve(svcCtx)
}, func() {
svcCancel()
@@ -101,7 +101,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("idm_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("idp_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -101,7 +101,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("idp_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -76,7 +76,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("invitations_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -90,7 +90,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("invitations_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -49,7 +49,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("nats_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
var tlsConf *tls.Config
@@ -88,7 +88,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.New("nats_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return natsServer.ListenAndServe()
}, func() {
natsServer.Shutdown()

View File

@@ -77,7 +77,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("notifications_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
// evs defines a list of events to subscribe to
@@ -140,7 +140,7 @@ func Server(cfg *config.Config) *cli.Command {
cfg.Notifications.EmailTemplatePath, cfg.Notifications.DefaultLanguage, cfg.WebUIURL,
cfg.Notifications.TranslationPath, cfg.Notifications.SMTP.Sender, notificationStore, historyClient, registeredEvents)
gr.Add(runner.New("notifications_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return svc.Run()
}, func() {
svc.Close()

View File

@@ -106,7 +106,7 @@ func Server(cfg *config.Config) *cli.Command {
// creating a runner for a go-micro service is a bit complex, so we'll
// wrap the go-micro service with an ocis service the same way as
// ocis-pkg/service/http is doing in order to reuse the factory.
gr.Add(runner.NewGoMicroHttpServerRunner("ocdav_http", ohttp.Service{Service: s}))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", ohttp.Service{Service: s}))
debugServer, err := debug.Server(
debug.Logger(logger),
@@ -119,7 +119,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("ocdav_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
grResults := gr.Run(ctx)

View File

@@ -74,7 +74,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("ocm_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -69,7 +69,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("ocs_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -84,7 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("ocs_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -102,7 +102,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroGrpcServerRunner("policies_grpc", svc))
gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", svc))
}
{
@@ -118,7 +118,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.New("policies_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return eventSvc.Run()
}, func() {
eventSvc.Close()
@@ -136,7 +136,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("policies_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -64,7 +64,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.New("postprocessing_svc", func() error {
gr.Add(runner.New(cfg.Service.Name+".svc", func() error {
return svc.Run()
}, func() {
svc.Close()

View File

@@ -205,7 +205,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("proxy_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -219,7 +219,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("proxy_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(cfg.Context)

View File

@@ -69,7 +69,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroGrpcServerRunner("search_grpc", grpcServer))
gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer))
debugServer, err := debug.Server(
debug.Logger(logger),
@@ -81,7 +81,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("search_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
grResults := gr.Run(ctx)

View File

@@ -73,7 +73,7 @@ func Server(cfg *config.Config) *cli.Command {
Msg("Error initializing http service")
return fmt.Errorf("could not initialize http service: %w", err)
}
gr.Add(runner.NewGoMicroHttpServerRunner("settings_http", httpServer))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", httpServer))
// prepare a gRPC server and add it to the group run.
grpcServer := grpc.Server(
@@ -85,7 +85,7 @@ func Server(cfg *config.Config) *cli.Command {
grpc.ServiceHandler(handle),
grpc.TraceProvider(traceProvider),
)
gr.Add(runner.NewGoMicroGrpcServerRunner("settings_grpc", grpcServer))
gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", grpcServer))
// prepare a debug server and add it to the group run.
debugServer, err := debug.Server(
@@ -98,7 +98,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("settings_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
grResults := gr.Run(ctx)

View File

@@ -92,7 +92,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("sharing_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())

View File

@@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("sse_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -89,7 +89,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("sse_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -64,7 +64,7 @@ func Server(cfg *config.Config) *cli.Command {
grpc.TraceProvider(traceProvider),
grpc.MaxConcurrentRequests(cfg.GRPC.MaxConcurrentRequests),
)
gr.Add(runner.NewGoMicroGrpcServerRunner("thumbnails_grpc", service))
gr.Add(runner.NewGoMicroGrpcServerRunner(cfg.Service.Name+".grpc", service))
server, err := debug.Server(
debug.Logger(logger),
@@ -75,7 +75,7 @@ func Server(cfg *config.Config) *cli.Command {
logger.Info().Err(err).Str("transport", "debug").Msg("Failed to initialize server")
return err
}
gr.Add(runner.NewGolangHttpServerRunner("thumbnails_debug", server))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", server))
httpServer, err := http.Server(
http.Logger(logger),
@@ -93,7 +93,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("thumbnails_http", httpServer))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", httpServer))
grResults := gr.Run(ctx)

View File

@@ -136,7 +136,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("userlog_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -150,7 +150,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("userlog_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -87,7 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("users_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
// FIXME we should defer registering the service until we are sure that reva is running

View File

@@ -76,7 +76,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("web_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -90,7 +90,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("web_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -71,7 +71,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("webdav_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -86,7 +86,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("webdav_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)

View File

@@ -84,7 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGoMicroHttpServerRunner("webfinger_http", server))
gr.Add(runner.NewGoMicroHttpServerRunner(cfg.Service.Name+".http", server))
}
{
@@ -99,7 +99,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
gr.Add(runner.NewGolangHttpServerRunner("webfinger_debug", debugServer))
gr.Add(runner.NewGolangHttpServerRunner(cfg.Service.Name+".debug", debugServer))
}
grResults := gr.Run(ctx)