mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-18 05:28:40 -04:00
make sure services have some time to deregister
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/rpc"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -514,7 +515,8 @@ func trap(s *Service, ctx context.Context) {
|
||||
}
|
||||
}
|
||||
s.Log.Debug().Str("service", "runtime service").Msgf("terminating with signal: %v", s)
|
||||
//os.Exit(0) // this seems to cause an early exit that prevents services from shitting down properly
|
||||
time.Sleep(3 * time.Second) // give the services time to deregister
|
||||
os.Exit(0) // FIXME this cause an early exit that prevents services from shitting down properly
|
||||
}
|
||||
|
||||
// pingNats will attempt to connect to nats, blocking until a connection is established
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.AppProviderConfigFromStruct(cfg)
|
||||
|
||||
@@ -41,11 +41,11 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
cancel()
|
||||
return nil
|
||||
}, func(err error) {
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
|
||||
@@ -49,6 +49,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.AuthAppConfigFromStruct(cfg)
|
||||
|
||||
@@ -54,6 +54,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.AuthBasicConfigFromStruct(cfg)
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.AuthBearerConfigFromStruct(cfg)
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.AuthMachineConfigFromStruct(cfg)
|
||||
|
||||
@@ -46,6 +46,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
rcfg := revaconfig.AuthMachineConfigFromStruct(cfg)
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
runtime.RunWithOptions(rcfg, pidFile,
|
||||
runtime.WithLogger(&logger.Logger),
|
||||
|
||||
@@ -46,6 +46,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
reg := registry.GetRegistry()
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.GatewayConfigFromStruct(cfg, logger)
|
||||
|
||||
@@ -54,6 +54,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.GroupsConfigFromStruct(cfg)
|
||||
|
||||
@@ -43,6 +43,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
rCfg := revaconfig.OCMConfigFromStruct(cfg, logger)
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
reg := registry.GetRegistry()
|
||||
|
||||
@@ -54,6 +54,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg, err := revaconfig.SharingConfigFromStruct(cfg, logger)
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.StoragePublicLinkConfigFromStruct(cfg)
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.StorageSharesConfigFromStruct(cfg)
|
||||
|
||||
@@ -41,6 +41,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.StorageSystemFromStruct(cfg)
|
||||
|
||||
@@ -43,6 +43,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
defer cancel()
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.StorageUsersConfigFromStruct(cfg)
|
||||
|
||||
@@ -54,6 +54,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the run group executes all interrupt handlers when the context is canceled
|
||||
gr.Add(func() error {
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}, func(_ error) {
|
||||
})
|
||||
|
||||
gr.Add(func() error {
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
rCfg := revaconfig.UsersConfigFromStruct(cfg)
|
||||
|
||||
Reference in New Issue
Block a user