diff --git a/lib/Resque/Failure/Redis.php b/lib/Resque/Failure/Redis.php index 72081870..7280e9c1 100644 --- a/lib/Resque/Failure/Redis.php +++ b/lib/Resque/Failure/Redis.php @@ -29,6 +29,7 @@ public function __construct($payload, $exception, $worker, $queue) $data->worker = (string)$worker; $data->queue = $queue; $data = json_encode($data); + Resque::redis()->set('job:' . $payload["id"] . ':status:errorcode', $exception->getCode()); Resque::redis()->rpush('failed', $data); } } diff --git a/lib/Resque/Job/Status.php b/lib/Resque/Job/Status.php index 80dfd1f3..c3472b16 100644 --- a/lib/Resque/Job/Status.php +++ b/lib/Resque/Job/Status.php @@ -12,7 +12,7 @@ class Resque_Job_Status const STATUS_RUNNING = 2; const STATUS_FAILED = 3; const STATUS_COMPLETE = 4; - const STATUS_EXPIRE_SECS = 604800; + const STATUS_EXPIRE_SECS = 2419200; /** * @var string The ID of the job this status class refers back to. @@ -106,13 +106,14 @@ public function update($status, $data) Resque::redis()->set((string)$this . ':timestarted', $now); } - // Expire the status for completed jobs after 24 hours + // Expire the status for completed jobs after 30 days if(in_array($status, self::$completeStatuses)) { Resque::redis()->set((string)$this . ':timecompleted', $now); Resque::redis()->expire((string)$this, self::STATUS_EXPIRE_SECS); Resque::redis()->expire((string)$this . ':timequeued', self::STATUS_EXPIRE_SECS); Resque::redis()->expire((string)$this . ':timestarted', self::STATUS_EXPIRE_SECS); Resque::redis()->expire((string)$this . ':timecompleted', self::STATUS_EXPIRE_SECS); + Resque::redis()->expire((string)$this . ':errorcode', self::STATUS_EXPIRE_SECS); } }