From 4f66427cef4faeebdc6140ab8ba7b8f860268d13 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Thu, 11 Feb 2021 09:05:13 -0600 Subject: [PATCH] Fix Fast Ping alerts always running (#12510) Alerts should only be ran if the status changes. This should restore some speed. Was broken by another fix. --- app/Jobs/PingCheck.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Jobs/PingCheck.php b/app/Jobs/PingCheck.php index 507fb8178e..866ebdb6ae 100644 --- a/app/Jobs/PingCheck.php +++ b/app/Jobs/PingCheck.php @@ -256,9 +256,11 @@ class PingCheck implements ShouldQueue $device->save(); // only saves if needed (which is every time because of last_ping) - echo "Device $device->hostname changed status to $type, running alerts\n"; - $rules = new AlertRules; - $rules->runRules($device->device_id); + if (isset($type)) { // only run alert rules if status changed + echo "Device $device->hostname changed status to $type, running alerts\n"; + $rules = new AlertRules; + $rules->runRules($device->device_id); + } // add data to rrd app('Datastore')->put($device->toArray(), 'ping-perf', $this->rrd_tags, ['ping' => $device->last_ping_timetaken]);