Skip to content

Commit 2a24423

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/master' into update_branche_30
# Conflicts: # src/Queue.php
2 parents 74fa7f3 + 26fb7fe commit 2a24423

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Yii2 Queue Extension Change Log
55
-----------------------
66
- Enh #516: Ensure Redis driver messages are consumed at least once (soul11201)
77
- Bug #522: Fix SQS driver type error with custom value passed to `queue/listen` (flaviovs)
8-
8+
- Bug #528: Prevent multiple execution of aborted jobs (luke-)
99

1010
2.3.7 April 29, 2024
1111
--------------------

src/Queue.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ public function getWorkerPid(): ?int
209209
protected function handleMessage(int|string $id, string $message, int $ttr, int $attempt): bool
210210
{
211211
[$job, $error] = $this->unserializeMessage($message);
212+
// Handle aborted jobs without throwing an error.
213+
if ($attempt > 1 &&
214+
(($job instanceof RetryableJobInterface && !$job->canRetry($attempt - 1, $error))
215+
|| (!($job instanceof RetryableJobInterface) && $attempt > $this->attempts))) {
216+
return true;
217+
}
212218
$event = new ExecEvent([
213219
'id' => $id,
214220
'job' => $job,

0 commit comments

Comments
 (0)