multicastmanager.class.php (fogproject-1.5.5) | : | multicastmanager.class.php (fogproject-1.5.6) | ||
---|---|---|---|---|
skipping to change at line 169 | skipping to change at line 169 | |||
/** | /** | |||
* Multicast tasks are a bit more than | * Multicast tasks are a bit more than | |||
* the others, this is its service loop | * the others, this is its service loop | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
private function _serviceLoop() | private function _serviceLoop() | |||
{ | { | |||
$KnownTasks = []; | $KnownTasks = []; | |||
while (true) { | while (true) { | |||
// Wait until db is ready. | ||||
// This is in the loop jus tin case the db goes down in between sess | ||||
ions. | ||||
$this->waitDbReady(); | ||||
// Ensure we have a fresh complete and cancel variable. | // Ensure we have a fresh complete and cancel variable. | |||
$completeTasks = $cancelTasks = []; | $completeTasks = $cancelTasks = []; | |||
// Handles the sleep timer for us. | // Handles the sleep timer for us. | |||
$date = self::niceDate(); | $date = self::niceDate(); | |||
if (!isset($nextrun)) { | if (!isset($nextrun)) { | |||
$first = true; | $first = true; | |||
$nextrun = clone $date; | $nextrun = clone $date; | |||
} | } | |||
// Actually holds and loops until the proper sleep time is met. | // Actually holds and loops until the proper sleep time is met. | |||
if ($date < $nextrun && $first === false) { | if ($date < $nextrun && $first === false) { | |||
usleep(100000); | usleep(100000); | |||
continue; | continue; | |||
} | } | |||
// Check db connection and wait until db is ready. | ||||
$this->waitDbReady(); | ||||
// Reset the next run time. | // Reset the next run time. | |||
$nextrun = self::niceDate(); | ||||
$nextrun->modify('+'.self::$zzz.' seconds'); | $nextrun->modify('+'.self::$zzz.' seconds'); | |||
// Sets the queued States each iteration incase there is a change. | // Sets the queued States each iteration incase there is a change. | |||
$queuedStates = self::fastmerge( | $queuedStates = self::fastmerge( | |||
self::getQueuedStates(), | self::getQueuedStates(), | |||
(array)self::getProgressState() | (array)self::getProgressState() | |||
); | ); | |||
// Sets the Done states each iteration incase there is a change. | // Sets the Done states each iteration incase there is a change. | |||
$doneStates = [ | $doneStates = [ | |||
self::getCompleteState(), | self::getCompleteState(), | |||
skipping to change at line 558 | skipping to change at line 558 | |||
); | ); | |||
unset($Task); | unset($Task); | |||
} | } | |||
} catch (Exception $e) { | } catch (Exception $e) { | |||
self::outall($e->getMessage()); | self::outall($e->getMessage()); | |||
} | } | |||
if ($first) { | if ($first) { | |||
$first = false; | $first = false; | |||
} | } | |||
$tmpTime = self::getSetting(self::$sleeptime); | $tmpTime = self::getSetting(self::$sleeptime); | |||
if (static::$zzz != $tmpTime) { | if ($tmpTime > 0 && static::$zzz != $tmpTime) { | |||
static::$zzz = $tmpTime ?: 10; | static::$zzz = $tmpTime ?: 10; | |||
self::outall( | self::outall( | |||
sprintf( | sprintf( | |||
' | %s %s %s.', | ' | %s %s %s.', | |||
_('Wait time has changed to'), | _('Wait time has changed to'), | |||
static::$zzz, | static::$zzz, | |||
( | ( | |||
static::$zzz != 1 ? | static::$zzz != 1 ? | |||
_('seconds') : | _('seconds') : | |||
_('second') | _('second') | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added |