title: laravel how to get the retry event in the Job?
body: <p>I use redis to store the number of unprocessed queued jobs for each user. </p>
  
  <p>In the controller, increment the jobNumber by 1 when dispatch a job for the user.</p>
  
  <pre><code>Job::dispatch($job);
  $redis-&gt;SET( $uid, $redis-&gt;GET($uid) + 1);
  </code></pre>
  
  <p>In the Job's <code>handle()</code> function decrement the jobNumber by 1 when a job begin processing. And rollback when the Job failed.</p>
  
  <pre><code>public function handle()
  {
      ...
      $redis-&gt;SET( $uid, $redis-&gt;GET($uid) - 1);
      ...
  }
  public function failed(\Exception $exception)
  {
      ...
      $redis-&gt;SET( $uid, $redis-&gt;GET($uid) + 1);
      \Log::info('job failed');
  }
  </code></pre>
  
  <p>This work well when the job can finish in the first time. But when a job fail in the first time and retry the number in the redis will decrease by 1 which shouldn't. </p>
  
  <p>Note the <code>failed</code> function only called when the job thoroughly failed, will not been called when retry. If there is a <code>retried</code> function like the <code>failed</code> would be better.</p>
  
  <p>So how can I catch the queue retry event in the Job.</p>