From 809874ee83eec3aff9fac491a99ee80f4bf95e38 Mon Sep 17 00:00:00 2001 From: Selwin Ong Date: Wed, 18 Jul 2012 17:36:41 +0700 Subject: [PATCH] Don't store Job's "_instance" attribute in Redis. --- rq/job.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rq/job.py b/rq/job.py index 095506b..ce7c754 100644 --- a/rq/job.py +++ b/rq/job.py @@ -9,7 +9,7 @@ from .exceptions import UnpickleError, NoSuchJobError JOB_ATTRS = set(['origin', '_func_name', 'ended_at', 'description', '_args', 'created_at', 'enqueued_at', 'connection', '_result', - 'timeout', '_kwargs', 'exc_info', '_id', 'data']) + 'timeout', '_kwargs', 'exc_info', '_id', 'data', '_instance']) def unpickle(pickled_string): @@ -194,7 +194,8 @@ class Job(object): """ key = self.key obj = self.connection.hgetall(key) - if obj.get('data') is None: + # hgetall returns an empty dict if key doesn't exist + if obj == {}: raise NoSuchJobError('No such job: %s' % (key,)) def to_date(date_str):