diff --git a/cron.php b/cron.php index 683f605..29e8e7e 100644 --- a/cron.php +++ b/cron.php @@ -1,10 +1,6 @@ getId() !== $task->getZoneId()) - $zoneInfo = $task->getZone(); + // Plow through tasks + // TODO: make task functions modular + while($task = array_shift($taskQueue)) { + if(!isset($zoneInfo) || $zoneInfo->getId() !== $task->getZoneId()) + $zoneInfo = $task->getZone(); - switch($task->getName()) { - case 'screenshot': - $zoneInfo->takeScreenshot(); - break; + switch($task->getName()) { + case 'screenshot': + $zoneInfo->takeScreenshot(); + break; + } + + $task->delete(); + } } - - $task->delete(); +} finally { + sem_release($semaphore); } - -sem_release($semaphore);