public function setStatus($status, \Exception $e = null)
    {
        if (!($packet = $this->getPacket())) {
            $packet = array(
                'id'        => $this->id,
                'queue'     => $this->queue,
                'payload'   => $this->payload,
                'worker'    => '',
                'status'    => $status,
                'created'   => microtime(true),
                'updated'   => microtime(true),
                'delayed'   => 0,
                'started'   => 0,
                'finished'  => 0,
                'output'    => '',
                'exception' => null,
            );
        }

        $packet['worker']  = (string)$this->worker;
        $packet['status']  = $status;
        $packet['updated'] = microtime(true);

        if ($status == Job::STATUS_RUNNING) {
            $packet['started'] = microtime(true);
        }

        if (in_array($status, self::$completeStatuses)) {
            $packet['finished'] = microtime(true);
        }

        if ($e) {
            $packet['exception'] = json_encode(array(
                'class'     => get_class($e),
                'error'     => sprintf('%s in %s on line %d', $e->getMessage(), $e->getFile(), $e->getLine()),
                'backtrace' => explode("\n", $e->getTraceAsString())
            ));
        }

        $this->redis->hmset(self::redisKey($this), $packet);

        // Expire the status for completed jobs
        if (in_array($status, self::$completeStatuses)) {
            $this->redis->expire(self::redisKey($this), \Resque::getConfig('default.expiry_time', \Resque::DEFAULT_EXPIRY_TIME));
        }
    }