mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
Fixed an upgrade/service bug where it would try to stop an already stopped service.
This commit is contained in:
@@ -100,17 +100,24 @@ namespace NzbDrone.Common
|
||||
|
||||
Logger.Info("Service is currently {0}", service.Status);
|
||||
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(60));
|
||||
|
||||
service.Refresh();
|
||||
if (service.Status == ServiceControllerStatus.Stopped)
|
||||
if (service.Status != ServiceControllerStatus.Stopped)
|
||||
{
|
||||
Logger.Info("{0} has stopped successfully.");
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(60));
|
||||
|
||||
service.Refresh();
|
||||
if (service.Status == ServiceControllerStatus.Stopped)
|
||||
{
|
||||
Logger.Info("{0} has stopped successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error("Service stop request has timed out. {0}", service.Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error("Service stop request has timed out. {0}", service.Status);
|
||||
Logger.Warn("Service {0} is already in stopped state.", service.ServiceName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user