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