Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
25 | 16 | final protected function execute(InputInterface $input, OutputInterface $output): ?int |
|
26 | { |
||
27 | 16 | $lockConfig = $this->getLockConfig(); |
|
28 | 16 | $lock = $this->locker->createLock($lockConfig->lockName(), $lockConfig->ttl(), $lockConfig->isBlocking()); |
|
29 | |||
30 | 16 | if (! $lock->acquire($lockConfig->isBlocking())) { |
|
31 | 1 | $output->writeln( |
|
32 | 1 | sprintf('<comment>Command "%s" is already in progress. Skipping.</comment>', $lockConfig->lockName()), |
|
33 | ); |
||
34 | 1 | return ExitCodes::EXIT_WARNING; |
|
35 | } |
||
36 | |||
37 | try { |
||
38 | 15 | return $this->lockedExecute($input, $output); |
|
39 | } finally { |
||
40 | 15 | $lock->release(); |
|
41 | } |
||
48 |