Skip to content

Commit 1f32645

Browse files
committed
feat(recurring): all jobs can be disabled when not on prod
1 parent 36ca482 commit 1f32645

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Resources/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ services:
2424
arguments:
2525
- '%kernel.root_dir%'
2626
- '@Markup\JobQueueBundle\Repository\JobStatusRepository'
27+
- '%kernel.environment%'
2728
markup_job_queue.writer.supervisord_config_file:
2829
class: Markup\JobQueueBundle\Service\SupervisordConfigFileWriter
2930
arguments:

Service/RecurringConsoleCommandReader.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,19 @@ class RecurringConsoleCommandReader
4141
/** @var JobStatusRepository */
4242
private $jobStatusRepository;
4343

44+
/**
45+
* @var string
46+
*/
47+
private $kernelEnv;
48+
4449
public function __construct(
4550
string $kernelPath,
46-
JobStatusRepository $jobStatusRepository
51+
JobStatusRepository $jobStatusRepository,
52+
string $kernelEnv
4753
) {
4854
$this->kernelPath = $kernelPath;
4955
$this->jobStatusRepository = $jobStatusRepository;
56+
$this->kernelEnv = $kernelEnv;
5057
}
5158

5259
public function setConfigurationFileName($name)
@@ -140,6 +147,11 @@ private function parseConfiguration(array $config)
140147
throw new InvalidConfigurationException(sprintf('`arguments` config key must be an array for %s', $group['command']));
141148
}
142149

150+
// user management by default when environment is not prod
151+
if ($this->kernelEnv !== 'prod' && !isset($group['user_managed'])) {
152+
$group['user_managed'] = true;
153+
}
154+
143155
$recurringConsoleCommandConfiguration = new RecurringConsoleCommandConfiguration(
144156
$group['command'],
145157
$group['arguments'] ?? [],

0 commit comments

Comments
 (0)