public function work(string $queueName, int $n = null, int $time = null)
{
$stopwatchStart = time();
while ($n === null || $n > 0) {
try {
$this->iterate($queueName, $time);
$n === null || $n--;
} catch (DriverException $exception) {
$this->implementation->getLogger()->error($exception->getMessage(), compact('exception'));
} catch (ConcurrencyException $exception) {
// do nothing
} catch (TimeoutException $exception) {
break;
}
if ($time !== null && time() - $stopwatchStart >= $time) {
break;
}
}
}