Skip to content

Commit 7a56a37

Browse files
committed
+ custom queued handler
1 parent 09573b1 commit 7a56a37

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Diff for: src/Jobs/CallQueuedHandler.php

+6-10
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,23 @@ class CallQueuedHandler extends LaravelHandler {
1616
*/
1717
protected function dispatchThroughMiddleware(Job $job, $command)
1818
{
19-
if ($this->hasExpired($command, $job->timestamp())) {
20-
throw new ExpiredJobException("This job has already expired");
19+
if (property_exists($command, 'class') && $this->hasExpired($command->class, $job->timestamp())) {
20+
throw new ExpiredJobException("Job {$command->class} has already expired");
2121
}
2222

2323
return parent::dispatchThroughMiddleware($job, $command);
2424
}
2525

2626
/**
27-
* @param $command
27+
* @param $className
2828
* @param $queuedAt
2929
* @return bool
3030
*/
31-
protected function hasExpired($command, $queuedAt) {
32-
if (! property_exists($command, 'class')) {
31+
protected function hasExpired($className, $queuedAt) {
32+
if (! property_exists($className, 'retention')) {
3333
return false;
3434
}
3535

36-
if (! property_exists($command->class, 'retention')) {
37-
return false;
38-
}
39-
40-
return time() > $queuedAt + $command->class::$retention;
36+
return time() > $queuedAt + $className::$retention;
4137
}
4238
}

0 commit comments

Comments
 (0)