make sure services have some time to deregister

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-10-28 11:22:58 +01:00
parent 32287da09e
commit 04632ad34c
18 changed files with 117 additions and 3 deletions

View File

@@ -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)