File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/Jenssegers/Mongodb/Queue Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -49,4 +49,45 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
4949 $ this ->releaseJob ($ job ['_id ' ], $ attempts );
5050 }
5151 }
52+
53+ /**
54+ * Release the given job ID from reservation.
55+ *
56+ * @param string $id
57+ *
58+ * @return void
59+ */
60+ protected function releaseJob ($ id , $ attempts )
61+ {
62+ $ this ->database ->table ($ this ->table )->where ('_id ' , $ id )->update ([
63+ 'reserved ' => 0 ,
64+ 'reserved_at ' => null ,
65+ 'attempts ' => $ attempts ,
66+ ]);
67+ }
68+
69+ /**
70+ * Mark the given job ID as reserved.
71+ *
72+ * @param string $id
73+ * @return void
74+ */
75+ protected function markJobAsReserved ($ id )
76+ {
77+ $ this ->database ->collection ($ this ->table )->where ('_id ' , $ id )->update ([
78+ 'reserved ' => 1 , 'reserved_at ' => $ this ->getTime (),
79+ ]);
80+ }
81+
82+ /**
83+ * Delete a reserved job from the queue.
84+ *
85+ * @param string $queue
86+ * @param string $id
87+ * @return void
88+ */
89+ public function deleteReserved ($ queue , $ id )
90+ {
91+ $ this ->database ->table ($ this ->table )->where ('_id ' , $ id )->delete ();
92+ }
5293}
You can’t perform that action at this time.
0 commit comments