Skip to content

Commit 4eebd3e

Browse files
author
Aytackydln
committed
handle hw?.Update() exceptions for shutdown
1 parent 2539a75 commit 4eebd3e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

Project-Aurora/Project-Aurora/Modules/HardwareMonitor/HardwareMonitor.HardwareUpdater.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,20 @@ protected HardwareUpdater()
4141
_updateTimer.Elapsed += (a, b) =>
4242
{
4343
if (inUse)
44-
hw?.Update();
44+
{
45+
try
46+
{
47+
hw?.Update();
48+
}
49+
catch (Exception ex)
50+
{
51+
Global.logger.Error(ex, "[HardwareMonitor] Exception during hardware update for {HwName} of type {HwHardwareType}",
52+
hw?.Name, hw?.HardwareType);
53+
_useTimer.Stop();
54+
}
55+
}
4556

46-
if (_updateTimer.Interval != Global.Configuration.HardwareMonitorUpdateRate)
57+
if ((int)_updateTimer.Interval != Global.Configuration.HardwareMonitorUpdateRate)
4758
_updateTimer.Interval = Global.Configuration.HardwareMonitorUpdateRate;
4859
};
4960
_updateTimer.Start();

0 commit comments

Comments
 (0)