Remove more os.Exit calls and give a more reliable wait for stop function

This commit is contained in:
Nate Brown authored and JackDoan committed 2026-01-28 12:59:09 -06:00
1 parent 42bee7cf17
commit 6f022a2fff
6 files changed
+109 -32

No files matched your search

+10 -1
View File
@@ -44,7 +44,10 @@ type Service struct {
}
func New(control *nebula.Control) (*Service, error) {
control.Start()
wait, err := control.Start()
if err != nil {
return nil, err
}
ctx := control.Context()
eg, ctx := errgroup.WithContext(ctx)
@@ -141,6 +144,12 @@ func New(control *nebula.Control) (*Service, error) {
}
})
// Add the nebula wait function to the group
eg.Go(func() error {
wait()
return nil
})
return &s, nil
}