Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit e501804

Browse files
authored
Merge pull request vyuldashev#65 from mintopia/mintopia
Fix for attempt counter
2 parents af6b1a8 + cc7d46f commit e501804

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ public function release($delay = 0)
111111
public function attempts()
112112
{
113113
$body = json_decode($this->message->body, true);
114-
115-
return isset($body['data']['attempts']) ? (int)$body['data']['attempts'] : 0;
114+
$job = unserialize($body['data']['command']);
115+
if (is_object($job) && property_exists($job, 'attempts'))
116+
{
117+
return (int) $job->attempts;
118+
}
119+
return 0;
116120
}
117121

118122
/**

0 commit comments

Comments
 (0)