Skip to content

Commit

Permalink
prevent TypeError when serialized task json data missing
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Aug 14, 2018
1 parent 18a11c9 commit 10b5fe7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tasktiger/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,20 +409,20 @@ def tasks_from_queue(self, tiger, queue, state, skip=0, limit=1000,
results = pipeline.execute()

for serialized_data, serialized_executions, ts in zip(results[0], results[1:], tss):
data = json.loads(serialized_data)
executions = [json.loads(e) for e in serialized_executions if e]

task = Task(tiger, queue=queue, _data=data, _state=state,
_ts=ts, _executions=executions)

tasks.append(task)
if serialized_data:
data = json.loads(serialized_data)
executions = [json.loads(e) for e in serialized_executions if e]
task = Task(tiger, queue=queue, _data=data, _state=state,
_ts=ts, _executions=executions)
tasks.append(task)
else:
data = tiger.connection.mget([tiger._key('task', item[0]) for item in items])
for serialized_data, ts in zip(data, tss):
data = json.loads(serialized_data)
task = Task(tiger, queue=queue, _data=data, _state=state,
_ts=ts)
tasks.append(task)
if serialized_data:
data = json.loads(serialized_data)
task = Task(tiger, queue=queue, _data=data, _state=state,
_ts=ts)
tasks.append(task)

return n, tasks

Expand Down

0 comments on commit 10b5fe7

Please sign in to comment.