diff --git a/pkg/core/runtime.go b/pkg/core/runtime.go index fa2d054..a81afbd 100644 --- a/pkg/core/runtime.go +++ b/pkg/core/runtime.go @@ -33,6 +33,7 @@ func (r *ServiceRuntime[T]) Config() *Config { return r.core.Config() } // ServiceStartup runs OnStart for all registered services that have one. func (c *Core) ServiceStartup(ctx context.Context, options any) Result { + c.shutdown.Store(false) startables := c.Startables() if startables.OK { for _, s := range startables.Value.([]*Service) { @@ -54,7 +55,9 @@ func (c *Core) ServiceShutdown(ctx context.Context) Result { c.shutdown.Store(true) c.ACTION(ActionServiceShutdown{}) - // Drain background tasks before stopping services + // Drain background tasks before stopping services. + // On timeout, the waiter goroutine persists until tasks complete — + // this is inherent to sync.WaitGroup (no cancel mechanism). done := make(chan struct{}) go func() { c.wg.Wait()