return if Service Start/Shutdown errors

Previously, a couple cases could just close the shutdown channel but
in logs it would appear as if they have been started.
This commit is contained in:
ionutboangiu
2025-05-29 17:49:07 +03:00
committed by Dan Christian Bogos
parent 4afe92695c
commit 9812e6f605

View File

@@ -64,6 +64,7 @@ func (m *ServiceManager) StartServices(shutdown *utils.SyncedChan) {
if err := svc.Start(shutdown, m.registry); err != nil {
utils.Logger.Err(fmt.Sprintf("<%s> failed to start <%s> service: %v", utils.ServiceManager, svc.ServiceName(), err))
shutdown.CloseOnce()
return
}
MustSetState(svc, utils.StateServiceUP)
utils.Logger.Info(fmt.Sprintf("<%s> started <%s> service", utils.ServiceManager, svc.ServiceName()))
@@ -116,6 +117,7 @@ func (m *ServiceManager) reloadService(id string, shutdown *utils.SyncedChan) (e
if err = svc.Shutdown(m.registry); err != nil {
utils.Logger.Err(fmt.Sprintf("<%s> failed to shut down <%s> service: %v", utils.ServiceManager, svc.ServiceName(), err))
shutdown.CloseOnce()
return
}
MustSetState(svc, utils.StateServiceDOWN)
utils.Logger.Info(fmt.Sprintf("<%s> stopped <%s> service", utils.ServiceManager, svc.ServiceName()))