Skip to content

Commit 2a62aeb

Browse files
fixup: Update core/Command/Background/JobWorker.php
Co-authored-by: Joas Schilling <[email protected]> Signed-off-by: Salvatore Martire <[email protected]>
1 parent 0b390e3 commit 2a62aeb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/Command/Background/JobWorker.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function configure(): void {
4949
'interval',
5050
'i',
5151
InputOption::VALUE_OPTIONAL,
52-
'Interval in seconds in which the worker should repeat already processed jobs',
52+
'Interval in seconds in which the worker should repeat already processed jobs (set to 0 for no repeat)',
5353
1
5454
)
5555
->addOption(
@@ -114,12 +114,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
114114
}
115115

116116
$output->writeln('Waiting for new jobs to be queued', OutputInterface::VERBOSITY_VERBOSE);
117+
if ((int)$input->getOption('interval') === 0) {
118+
break;
119+
}
117120
// Re-check interval for new jobs
118-
sleep($input->getOption('interval'));
121+
sleep((int)$input->getOption('interval'));
119122
continue;
120123
}
121124

122-
$output->writeln('<comment>Job ' . $job::class . ' is a TimedJob, this command is designed to run QueuedJob.</comment>');
123125
$output->writeln('Running job ' . get_class($job) . ' with ID ' . $job->getId());
124126

125127
if ($output->isVerbose()) {

0 commit comments

Comments
 (0)