mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix downtime in corner cases (#16040)
If somehow device outage wasn't recorded, fall back to last_polled (or now) This should not happen in normal operation fixes #15634
This commit is contained in:
@@ -279,7 +279,13 @@ class Device extends BaseModel
|
||||
*/
|
||||
public function downSince(): Carbon
|
||||
{
|
||||
return Carbon::createFromTimestamp((int) $this->getCurrentOutage()?->going_down);
|
||||
$deviceOutage = $this->getCurrentOutage();
|
||||
|
||||
if ($deviceOutage) {
|
||||
return Carbon::createFromTimestamp((int) $deviceOutage->going_down);
|
||||
}
|
||||
|
||||
return $this->last_polled ?? Carbon::now();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user