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); } }
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()); }
/** * Log events that occur from queue * * @access public * @param QueueLockEvent $event */ public function logQueueUnlockEvent(QueueLockEvent $event) { $this->log->info('QueueUnlockEvent:: Unlocking Jobs with params', array('handle' => $event->getLimit(), 'limit' => $event->getLimit())); }
/** * Log events that occur from queue * * @access public * @param QueueLockEvent $event */ public function logQueueUnlockEvent(QueueLockEvent $event) { $this->output->writeln('QueueUnlockEvent:: Unlocking Jobs with params ' . json_encode(array('handle' => $event->getLimit(), 'limit' => $event->getLimit()))); }