Added 48 hour TTL to worker:xxx:started keys to prevent db pollution

This commit is contained in:
Daniel Mason 2018-05-30 08:25:02 +12:00
parent b235fce1bd
commit 493d6dc6d8
17 changed files with 158 additions and 141 deletions

View file

@ -29,10 +29,10 @@ class Resque_Job_Status
/**
* @var array Array of statuses that are considered final/complete.
*/
private static $completeStatuses = array(
private static $completeStatuses = [
self::STATUS_FAILED,
self::STATUS_COMPLETE
);
];
/**
* Setup a new instance of the job monitor class for the supplied job ID.
@ -52,11 +52,11 @@ class Resque_Job_Status
*/
public static function create($id)
{
$statusPacket = array(
$statusPacket = [
'status' => self::STATUS_WAITING,
'updated' => time(),
'started' => time(),
);
];
Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket));
}