Skip to content

Commit 48f9537

Browse files
committed
Merge pull request #25 from gaillard/master
Couple changes to work with newer pecl mongo extension without breaking existing.
2 parents 147e719 + b5e3cb4 commit 48f9537

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Queue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ public function get(array $query, $runningResetDuration, $waitDurationInMillis =
215215

216216
while (true) {
217217
$message = $this->_collection->findAndModify($completeQuery, $update, $fields, $options);
218-
//checking if _id exist because findAndModify doesnt seem to return null when it can't match the query
219-
if (array_key_exists('_id', $message)) {
218+
//checking if _id exist because findAndModify doesnt seem to return null when it can't match the query on older mongo extension
219+
if ($message !== null && array_key_exists('_id', $message)) {
220220
//id on left of union operator so a possible id in payload doesnt wipe it out the generated one
221221
return array('id' => $message['_id']) + $message['payload'];
222222
}
@@ -452,7 +452,7 @@ private function _ensureIndex(array $index)
452452

453453
try {
454454
$this->_collection->ensureIndex($index, array('name' => $name, 'background' => true));
455-
} catch (\MongoCursorException $e) {
455+
} catch (\MongoException $e) {
456456
//this happens when the name was too long, let continue
457457
}
458458

0 commit comments

Comments
 (0)