diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index 69d1d62fa47189fdbf5afa49ca5697e1d37bec42..0b71c5b678651380eec4a25d2f5497954a7588b6 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -92,6 +92,26 @@ namespace ATxService LoadSettings(); CreateIncomingDirectories(); + try { + _cpu = new Cpu { + Interval = 250, + Limit = _config.MaxCpuUsage, + Probation = 16, + Enabled = true + }; + } + catch (UnauthorizedAccessException ex) { + Log.Error("Not enough permissions to monitor the CPU load.\nMake sure the " + + "service account is a member of the [Performance Monitor Users] " + + "system group.\nError message was: {0}", ex.Message); + throw; + } + catch (Exception ex) { + Log.Error("Unexpected error initializing CPU monitoring: {0}", ex.Message); + throw; + } + + if (_config.DebugRoboSharp) { Debugger.Instance.DebugMessageEvent += HandleDebugMessage; Log.Debug("Enabled RoboSharp debug logging."); @@ -386,26 +406,6 @@ namespace ATxService throw; } - try { - _cpu = new Cpu { - Interval = 250, - Limit = 25, - Probation = 16, - Enabled = true - }; - } - catch (UnauthorizedAccessException ex) { - Log.Error("Not enough permissions to monitor the CPU load.\nMake sure the " + - "service account is a member of the [Performance Monitor Users] " + - "system group.\nError message was: {0}", ex.Message); - throw; - } - catch (Exception ex) { - Log.Error("Unexpected error initializing CPU monitoring: {0}", ex.Message); - throw; - } - - // read the build timestamp from the resources: var buildTimestamp = Properties.Resources.BuildDate.Trim(); var buildCommitName = Properties.Resources.BuildCommit.Trim();