Assuming that $this->cache->increment('job-exceptions:'.$uuid) refers to the default cache store, clearly the exception count will be available at $this->cache->get('job-exceptions:'.$uuid). I'll put that to the test.
Can the current exception count be accessed from within a queue job?
I have a standard job configured. I would like to determine my $job->release() value based on the current exception count.
I was using $job->attempts() to modify the $job->release() value but the problem that I am having is that Laravel actually increments $job->attempts() despite whether the job was attempted or not. For example, if I allow only two jobs to run at once, when Laravel prepares to run the third job while the other two or running, it will mark job #3 as attempted though really it was only queued for later - it never attempted to run.
For my use-case, based on the number exceptions that have been logged for the job, I want to adjust my release() value.
p.s.
I see that the \Illuminate\Queue\Worker class calls $this->cache->increment('job-exceptions:'.$uuid) to keep count of the exceptions. This would be the value that I am hoping to gain access to.
Please or to participate in this conversation.