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.
This commit is contained in:
Tony Murray
2021-02-11 09:05:13 -06:00
committed by GitHub
parent 137b7218da
commit 4f66427cef

View File

@ -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]);