Skip to content

Commit 297da58

Browse files
committed
Tweak new queue code
1 parent cd355cb commit 297da58

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Jenssegers/Mongodb/Queue/MongoQueue.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
use Illuminate\Queue\DatabaseQueue;
55
use Illuminate\Queue\Jobs\DatabaseJob;
66
use MongoDB\Operation\FindOneAndUpdate;
7-
use DB;
87

98
class MongoQueue extends DatabaseQueue
109
{
1110
/**
1211
* Pop the next job off of the queue.
1312
*
14-
* @param string $queue
15-
*
13+
* @param string $queue
1614
* @return \Illuminate\Contracts\Queue\Job|null
1715
*/
1816
public function pop($queue = null)
@@ -47,7 +45,7 @@ public function pop($queue = null)
4745
*/
4846
protected function getNextAvailableJobAndReserve($queue)
4947
{
50-
$job = DB::getCollection($this->table)->findOneAndUpdate(
48+
$job = $this->database->getCollection($this->table)->findOneAndUpdate(
5149
[
5250
'queue' => $this->getQueue($queue),
5351
'reserved' => 0,
@@ -98,7 +96,7 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
9896
* Release the given job ID from reservation.
9997
*
10098
* @param string $id
101-
*
99+
* @param int $attempts
102100
* @return void
103101
*/
104102
protected function releaseJob($id, $attempts)
@@ -119,6 +117,6 @@ protected function releaseJob($id, $attempts)
119117
*/
120118
public function deleteReserved($queue, $id)
121119
{
122-
$this->database->table($this->table)->where('_id', $id)->delete();
120+
$this->database->collection($this->table)->where('_id', $id)->delete();
123121
}
124122
}

0 commit comments

Comments
 (0)