Fix bug where results wasn't correctly unpickled when refreshing from Redis.

This commit is contained in:
Vincent Driessen 2012-07-20 14:26:05 +02:00
parent a9c6795b0e
commit 1a178d673b
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,9 @@
### 0.?.? ### 0.?.?
(Not yet released) (Not yet released)
- Fix important bug where result data wasn't restored from Redis correctly
(affected non-string results only).
### 0.2.0 ### 0.2.0
(July 18th, 2012) (July 18th, 2012)

View File

@ -211,7 +211,7 @@ class Job(object):
self.description = obj.get('description') self.description = obj.get('description')
self.enqueued_at = to_date(obj.get('enqueued_at')) self.enqueued_at = to_date(obj.get('enqueued_at'))
self.ended_at = to_date(obj.get('ended_at')) self.ended_at = to_date(obj.get('ended_at'))
self._result = obj.get('result') self._result = unpickle(obj.get('result')) if obj.get('result') else None
self.exc_info = obj.get('exc_info') self.exc_info = obj.get('exc_info')
self.timeout = int(obj.get('timeout')) if obj.get('timeout') else None self.timeout = int(obj.get('timeout')) if obj.get('timeout') else None
@ -238,7 +238,7 @@ class Job(object):
if self.ended_at is not None: if self.ended_at is not None:
obj['ended_at'] = times.format(self.ended_at, 'UTC') obj['ended_at'] = times.format(self.ended_at, 'UTC')
if self._result is not None: if self._result is not None:
obj['result'] = self._result obj['result'] = dumps(self._result)
if self.exc_info is not None: if self.exc_info is not None:
obj['exc_info'] = self.exc_info obj['exc_info'] = self.exc_info
if self.timeout is not None: if self.timeout is not None: