From c329439aac86de8f39d8978a0def99df72ca1332 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 20 Apr 2026 15:24:36 +0200 Subject: [PATCH] Hotfix for https://github.com/opencloud-eu/opencloud/issues/2282 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörn Dreyer Signed-off-by: Christian Richter --- opencloud/cmd/opencloud/main.go | 7 +++++++ services/nats/pkg/command/server.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/opencloud/cmd/opencloud/main.go b/opencloud/cmd/opencloud/main.go index 7968efc1d8..c80d4aca9c 100644 --- a/opencloud/cmd/opencloud/main.go +++ b/opencloud/cmd/opencloud/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "time" "github.com/opencloud-eu/opencloud/opencloud/pkg/command" ) @@ -12,4 +13,10 @@ func main() { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(1) } + // INFO: this is a hotfix, we need to replace suture and wait for nats to + // gracefully shutdown using rungroups + // see https://github.com/opencloud-eu/opencloud/issues/2282 + fmt.Println("Waiting for 30 seconds before exiting...") + time.Sleep(30 * time.Second) + fmt.Println("Exiting...") } diff --git a/services/nats/pkg/command/server.go b/services/nats/pkg/command/server.go index 342036167e..9f994bd79b 100644 --- a/services/nats/pkg/command/server.go +++ b/services/nats/pkg/command/server.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "fmt" "os/signal" + "time" "github.com/opencloud-eu/opencloud/pkg/config/configlog" pkgcrypto "github.com/opencloud-eu/opencloud/pkg/crypto" @@ -91,7 +92,13 @@ func Server(cfg *config.Config) *cobra.Command { gr.Add(runner.New(cfg.Service.Name+".svc", func() error { return natsServer.ListenAndServe() }, func() { + // INFO: this is a hotfix, we need to replace suture and wait for nats to + // gracefully shutdown using rungroups + // see https://github.com/opencloud-eu/opencloud/issues/2282 + logger.Info().Msg("Gracefully shutting down the NATS server...") natsServer.Shutdown() + time.Sleep(5 * time.Second) // wait for the server to shutdown gracefully + logger.Info().Msg("NATS server shutdown") })) grResults := gr.Run(ctx)