Exemplo n.º 1
0
 public function onUnlock(QueueLockEvent $event)
 {
     try {
         $this->gateway->updateQuery()->start()->addColumn('handle', null)->addColumn('lock_timeout', null)->where()->filterByLockout($event->getHandle())->end()->update();
         # did we lock some rows
         $event->setResult($this->gateway->rowsAffected());
     } catch (DBALGatewayException $e) {
         $event->setResult(0);
         throw new LaterJobException($e->getMessage(), 0, $e);
     }
 }
Exemplo n.º 2
0
 public function testQueueLockEvent()
 {
     $handle = '4b336e15-cac0-3307-8b81-f1de26e6c383';
     $now = new DateTime();
     $timeout = new DateTime();
     $limit = 20;
     $result = 10;
     $lock = new QueueLockEvent($handle, $timeout, $limit, $now);
     $lock->setResult($result);
     $this->assertEquals($handle, $lock->getHandle());
     $this->assertEquals($result, $lock->getResult());
     $this->assertEquals($timeout, $lock->getTimeout());
     $this->assertEquals($limit, $lock->getLimit());
     $this->assertEquals($now, $lock->getNow());
 }