File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,25 @@ public function deleteReserved($queue, $id)
321321 });
322322 }
323323
324+ /**
325+ * Delete a reserved job from the reserved queue and release it.
326+ *
327+ * @param string $queue
328+ * @param \Illuminate\Queue\Jobs\DatabaseJob $job
329+ * @param int $delay
330+ * @return void
331+ */
332+ public function deleteAndRelease ($ queue , $ job , $ delay )
333+ {
334+ $ this ->database ->transaction (function () use ($ queue , $ job , $ delay ) {
335+ if ($ this ->database ->table ($ this ->table )->lockForUpdate ()->find ($ job ->getJobId ())) {
336+ $ this ->database ->table ($ this ->table )->where ('id ' , $ job ->getJobId ())->delete ();
337+ }
338+
339+ $ this ->release ($ queue , $ job ->getJobRecord (), $ delay );
340+ });
341+ }
342+
324343 /**
325344 * Get the queue or return the default.
326345 *
Original file line number Diff line number Diff line change @@ -51,9 +51,7 @@ public function release($delay = 0)
5151 {
5252 parent ::release ($ delay );
5353
54- $ this ->delete ();
55-
56- return $ this ->database ->release ($ this ->queue , $ this ->job , $ delay );
54+ return $ this ->database ->deleteAndRelease ($ this ->queue , $ this , $ delay );
5755 }
5856
5957 /**
@@ -97,4 +95,14 @@ public function getRawBody()
9795 {
9896 return $ this ->job ->payload ;
9997 }
98+
99+ /**
100+ * Get the database job record.
101+ *
102+ * @return \Illuminate\Queue\Jobs\DatabaseJobRecord
103+ */
104+ public function getJobRecord ()
105+ {
106+ return $ this ->job ;
107+ }
100108}
You can’t perform that action at this time.
0 commit comments