Skip to content

Commit 1ff68c6

Browse files
committed
added delay feature to job release method
1 parent b17bb60 commit 1ff68c6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/FintechFab/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ public function release($delay = 0)
5757
// write attempts to body
5858
$body['data']['attempts'] = $attempts + 1;
5959

60+
$job = $body['job'];
61+
$data = $body['data'];
62+
6063
// push back to a queue
61-
Queue::push($body['job'], $body['data']);
64+
if ($delay > 0) {
65+
Queue::later($delay, $job, $data, $this->queue->getName());
66+
} else {
67+
Queue::push($job, $data, $this->queue->getName());
68+
}
6269
}
6370

6471
/**

0 commit comments

Comments
 (0)