mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 22:48:20 +01:00
Merge pull request #442 from tgstation/437-HandleDeadOnArrival
Fix watchdog crashing if DreamDaemon immediately exits
This commit is contained in:
@@ -346,8 +346,12 @@ namespace TGS.Server
|
||||
CurrentDDLog = DateTime.UtcNow.ToString("yyyy-MM-ddTHH-mm-ssZ");
|
||||
WriteCurrentDDLog("Starting monitoring...");
|
||||
}
|
||||
pcpu = new PerformanceCounter("Process", "% Processor Time", Proc.ProcessName, true);
|
||||
MemTrackTimer.Start();
|
||||
try
|
||||
{
|
||||
pcpu = new PerformanceCounter("Process", "% Processor Time", Proc.ProcessName, true);
|
||||
MemTrackTimer.Start();
|
||||
}
|
||||
catch (InvalidOperationException) { /*process already exited*/ }
|
||||
try
|
||||
{
|
||||
Proc.WaitForExit();
|
||||
@@ -357,7 +361,7 @@ namespace TGS.Server
|
||||
lock (watchdogLock) //synchronize
|
||||
{
|
||||
MemTrackTimer.Stop();
|
||||
pcpu.Dispose();
|
||||
pcpu?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user