title: Laravel Queue deadlock when deleting from jobs table
body: <p>I've just got Laravel Queue working with my project. I have Supervisor enabled so everything is automated but when jobs are being deleted from the jobs table, deadlocks are occurring. I am using MySQL as the driver.</p>
  
  <p>How can I stop these deadlocks?</p>
  
  <pre><code>Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: delete from `jobs` where `id` = 813)
  </code></pre>
  
  <pre><code>[program:laravel-worker]
  process_name=%(program_name)s_%(process_num)02d
  command=php /home/controlapi/public_html/total-control-api/artisan queue:work database --sleep=3 --tries=3
  autostart=true
  autorestart=true
  user=controlapi
  numprocs=10
  redirect_stderr=true
  stdout_logfile=/home/controlapi/public_html/total-control-api/storage/logs/worker.log
  </code></pre>
  
  <p><strong>Edit: Below is my query that is running with each job</strong></p>
  
  <pre><code>DB::transaction(function() use ($decode, $status, $c_decode, $m_decode, $d_decode) {
  
      try {
          $query = DB::connection('mysql2')-&gt;statement('INSERT INTO transactions (json, uuid, status, divisionName, divisionUuid, merchantName, merchantUuid, channelName, channelUuid, channelLogin, channelPwd)
                                                          VALUES (:transaction_1, :uuid, :status_1, :divisionName, :divisionUuid, :merchantName, :merchantUuid, :channelName, :channelUuid, :channelLogin, :channelPwd)
                                                          ON DUPLICATE KEY UPDATE json = :transaction_2, status = :status_2',
                                                          array('transaction_1' =&gt; $this-&gt;transaction,
                                                              'transaction_2' =&gt; $this-&gt;transaction,
                                                              'uuid' =&gt; $decode-&gt;payload-&gt;id,
                                                              'status_1' =&gt; $status-&gt;status,
                                                              'status_2' =&gt; $status-&gt;status,
                                                              'divisionName' =&gt; $d_decode-&gt;divisionInfo-&gt;name,
                                                              'divisionUuid' =&gt; $d_decode-&gt;divisionInfo-&gt;id,
                                                              'merchantName' =&gt; $m_decode-&gt;merchantInfo-&gt;name,
                                                              'merchantUuid' =&gt; $m_decode-&gt;merchantInfo-&gt;id,
                                                              'channelName' =&gt; $c_decode-&gt;channelInfo-&gt;name,
                                                              'channelUuid' =&gt; $c_decode-&gt;channelInfo-&gt;channel,
                                                              'channelLogin' =&gt; $c_decode-&gt;channelInfo-&gt;login,
                                                              'channelPwd' =&gt; $c_decode-&gt;channelInfo-&gt;pwd));
      }
      catch(Exception $e) {
          Storage::prepend('transactions_insert_errors.txt', Carbon::now('UTC')-&gt;toDateTimeString()."\nUUID:".$decode-&gt;payload-&gt;id."\n".$e-&gt;getMessage()."\n\n");
      }
  }, 5);
  </code></pre>