Skip to content

Commit

Permalink
#16: Timeout of queue reading lock for db driver
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuravljov committed Mar 26, 2017
1 parent 863237b commit c167d95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/db/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class Driver extends BaseDriver implements BootstrapInterface
* @var Mutex|array|string
*/
public $mutex = 'mutex';
/**
* @var int timeout
*/
public $mutexTimeout = 3;
/**
* @var string table name
*/
Expand Down Expand Up @@ -125,7 +129,7 @@ public function listen($delay)
*/
protected function pop()
{
if (!$this->mutex->acquire(__CLASS__ . $this->channel, 3)) {
if (!$this->mutex->acquire(__CLASS__ . $this->channel, $this->mutexTimeout)) {
throw new Exception("Has not waited the lock.");
}

Expand Down

0 comments on commit c167d95

Please sign in to comment.