Skip to content

Commit

Permalink
add default container.
Browse files Browse the repository at this point in the history
  • Loading branch information
freyhsiao committed Aug 26, 2019
1 parent 31bba0e commit ef38d6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Queue/CMQQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Freyo\LaravelQueueCMQ\Queue\Driver\Message;
use Freyo\LaravelQueueCMQ\Queue\Driver\Topic;
use Freyo\LaravelQueueCMQ\Queue\Jobs\CMQJob;
use Illuminate\Container\Container;
use Illuminate\Contracts\Queue\Queue as QueueContract;
use Illuminate\Queue\Queue;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -210,13 +211,16 @@ public function pop($queue = null)
$message = $queue->receive_message($this->queueOptions['polling_wait_seconds']);
} catch (CMQServerException $e) {
if (self::CMQ_QUEUE_NO_MESSAGE_CODE === (int) $e->getCode()) { // ignore no message
return;
return null;
}

throw $e;
}

return new CMQJob($this->container, $this, $message, $queue, $this->connectionName);
return new CMQJob(
$this->container ?: Container::getInstance(),
$this, $message, $queue, $this->connectionName
);
}

/**
Expand Down

0 comments on commit ef38d6e

Please sign in to comment.