Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ccce0303c3 |
@@ -47,10 +47,12 @@ class MonitorDispatcher
|
|||||||
|
|
||||||
private function cleanupStuckMonitors(): void
|
private function cleanupStuckMonitors(): void
|
||||||
{
|
{
|
||||||
|
$hoursStuck = 4;
|
||||||
$monitors = $this->monitorRepository->findBy(['status' => 'In Progress']);
|
$monitors = $this->monitorRepository->findBy(['status' => 'In Progress']);
|
||||||
foreach ($monitors as $monitor) {
|
foreach ($monitors as $monitor) {
|
||||||
// Reset the status to active so it will be executed again
|
// Reset the status to active so it will be executed again
|
||||||
if ($monitor->getLastSearch()->diffInHours(Carbon::today()) > 6) {
|
if ($monitor->getLastSearch()->diffInHours(Carbon::today()) > $hoursStuck) {
|
||||||
|
$this->logger->info('[MonitorDispatcher] Cleaning up monitor: ' . $monitor->getId() . ' (' . $monitor->getTitle() . '), resetting status to \'Active\' from \''. $monitor->getStatus() .'\' after being stuck for ' . $hoursStuck . ' hours.');
|
||||||
$monitor->setStatus('Active');
|
$monitor->setStatus('Active');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user