Skip to content

Commit caf3581

Browse files
committed
ICM: Formatted & getMutexName() method added.
1 parent d11c2c3 commit caf3581

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/WithoutOverlapping.php

+17-10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77

88
trait WithoutOverlapping
99
{
10+
public function getMutexStrategy()
11+
{
12+
return (isset($this->mutexStrategy) ? $this->mutexStrategy : 'file');
13+
}
14+
15+
public function setMutexStrategy($strategy)
16+
{
17+
$this->mutexStrategy = $strategy;
18+
}
19+
20+
public function getMutexName()
21+
{
22+
$name = $this->getName();
23+
$arguments = json_encode($this->argument());
24+
return "icmutex-{$name}-" . md5($arguments);
25+
}
26+
1027
protected function execute(InputInterface $input, OutputInterface $output)
1128
{
1229
$mutex = new Mutex($this);
@@ -20,14 +37,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
2037

2138
return $code;
2239
}
23-
24-
public function getMutexStrategy()
25-
{
26-
return (isset($this->mutexStrategy) ? $this->mutexStrategy : 'file');
27-
}
28-
29-
public function setMutexStrategy($strategy)
30-
{
31-
$this->mutexStrategy = $strategy;
32-
}
3340
}

0 commit comments

Comments
 (0)