/**
  * {@inheritDoc}
  */
 public function delete(WorkerInterface $worker)
 {
     $id = $worker->getId();
     $this->redis->srem('workers', $id);
     $this->redis->del('worker:' . $id);
     $this->redis->del('worker:' . $id . ':started');
     return $this;
 }
 function it_deletes_workers_from_redis(RedisClientInterface $redis, WorkerInterface $worker)
 {
     $worker->getId()->shouldBeCalled()->willReturn('local:789');
     $redis->srem('workers', 'local:789')->shouldBeCalled()->willReturn(1);
     $redis->del('worker:local:789')->shouldBeCalled()->willReturn(1);
     $redis->del('worker:local:789:started')->shouldBeCalled()->willReturn(1);
     $this->delete($worker)->shouldReturn($this);
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 public function save(JobInterface $job, \Exception $exception, WorkerInterface $worker)
 {
     $queue = $job instanceof OriginQueueAwareInterface ? $job->getOriginQueue() : null;
     $this->redis->rpush('failed', json_encode(array('failed_at' => date('c'), 'payload' => $job, 'exception' => get_class($exception), 'error' => $exception->getMessage(), 'backtrace' => explode("\n", $exception->getTraceAsString()), 'worker' => $worker->getId(), 'queue' => $queue instanceof QueueInterface ? $queue->getName() : null)));
 }
 /**
  * {@inheritDoc}
  */
 public function has(WorkerInterface $worker)
 {
     return isset($this->workers[$worker->getId()]);
 }