Compare commits
No commits in common. "master" and "v1.0.5" have entirely different histories.
1 changed files with 2 additions and 8 deletions
|
@ -21,15 +21,9 @@ class LockableMessageMiddleware implements MiddlewareInterface
|
||||||
*/
|
*/
|
||||||
private $lockFactory;
|
private $lockFactory;
|
||||||
|
|
||||||
/**
|
public function __construct(LockFactory $lockFactory)
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $ttl;
|
|
||||||
|
|
||||||
public function __construct(LockFactory $lockFactory, int $ttl = null)
|
|
||||||
{
|
{
|
||||||
$this->lockFactory = $lockFactory;
|
$this->lockFactory = $lockFactory;
|
||||||
$this->ttl = $ttl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +39,7 @@ class LockableMessageMiddleware implements MiddlewareInterface
|
||||||
$message = $envelope->getMessage();
|
$message = $envelope->getMessage();
|
||||||
|
|
||||||
if ($envelope->all(ReceivedStamp::class) && $message instanceof LockableMessage) {
|
if ($envelope->all(ReceivedStamp::class) && $message instanceof LockableMessage) {
|
||||||
$lock = $this->lockFactory->createLock($this->objectHash($message), $this->ttl);
|
$lock = $this->lockFactory->createLock($this->objectHash($message), null);
|
||||||
if (!$lock->acquire()) {
|
if (!$lock->acquire()) {
|
||||||
return $envelope;
|
return $envelope;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue