/** * Release the jobs that have been reserved for too long. * * @param string $queue * @return void */ protected function releaseJobsThatHaveBeenReservedTooLong($queue) { $expired = Carbon::now()->subSeconds($this->expire)->getTimestamp(); $reserved = $this->database->collection($this->table)->where('queue', $this->getQueue($queue))->where('reserved', 1)->where('reserved_at', '<=', $expired)->get(); foreach ($reserved as $job) { $attempts = $job['attempts'] + 1; $this->releaseJob($job['_id'], $attempts); } }