if ($memoryLimit =
$input->
getOption('memory-limit'
)) { $stopsWhen[] = "exceeded {
$memoryLimit} of memory";
$this->eventDispatcher->
addSubscriber(new StopWorkerOnMemoryLimitListener($this->
convertToBytes($memoryLimit),
$this->logger
));
} if (null !==
$timeLimit =
$input->
getOption('time-limit'
)) { if (!
is_numeric($timeLimit) || 0 >=
$timeLimit) { throw new InvalidOptionException(sprintf('Option "time-limit" must be a positive integer, "%s" passed.',
$timeLimit));
} $stopsWhen[] = "been running for {
$timeLimit}s";
$this->eventDispatcher->
addSubscriber(new StopWorkerOnTimeLimitListener($timeLimit,
$this->logger
));
} $stopsWhen[] = 'received a stop signal via the messenger:stop-workers command';
$io =
new SymfonyStyle($input,
$output instanceof ConsoleOutputInterface ?
$output->
getErrorOutput() :
$output);
$io->
success(sprintf('Consuming messages from transport%s "%s".', \
count($receivers) > 1 ? 's' : '',
implode(', ',
$receiverNames)));
if ($stopsWhen) { $last =
array_pop($stopsWhen);
$stopsWhen =
($stopsWhen ?
implode(', ',
$stopsWhen).' or ' : ''
).
$last;
$io->
comment("The worker will automatically exit once it has {
$stopsWhen}."
);
}