protected function configure(): void
{ $this ->
addOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'
) ->
addOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'
) ->
addOption('no-wait', null, InputOption::VALUE_NONE, 'Do not wait for next cycle of scheduled tasks'
);
} protected function execute(InputInterface
$input, OutputInterface
$output): int
{ if ($input->
getOption('no-wait'
)) { $this->scheduler->
queueScheduledTasks();
$output->
writeln('Scheduled tasks has been queued'
);
return Command::SUCCESS;
} $startTime =
microtime(true
);
$endTime = null;
$timeLimit =
(int) $input->
getOption('time-limit'
);
if ($timeLimit) { $endTime =
$startTime +
$timeLimit;
}