Skip to content

Commit 10b5fe7

Browse files
committed
prevent TypeError when serialized task json data missing
1 parent 18a11c9 commit 10b5fe7

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

tasktiger/task.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -409,20 +409,20 @@ def tasks_from_queue(self, tiger, queue, state, skip=0, limit=1000,
409409
results = pipeline.execute()
410410

411411
for serialized_data, serialized_executions, ts in zip(results[0], results[1:], tss):
412-
data = json.loads(serialized_data)
413-
executions = [json.loads(e) for e in serialized_executions if e]
414-
415-
task = Task(tiger, queue=queue, _data=data, _state=state,
416-
_ts=ts, _executions=executions)
417-
418-
tasks.append(task)
412+
if serialized_data:
413+
data = json.loads(serialized_data)
414+
executions = [json.loads(e) for e in serialized_executions if e]
415+
task = Task(tiger, queue=queue, _data=data, _state=state,
416+
_ts=ts, _executions=executions)
417+
tasks.append(task)
419418
else:
420419
data = tiger.connection.mget([tiger._key('task', item[0]) for item in items])
421420
for serialized_data, ts in zip(data, tss):
422-
data = json.loads(serialized_data)
423-
task = Task(tiger, queue=queue, _data=data, _state=state,
424-
_ts=ts)
425-
tasks.append(task)
421+
if serialized_data:
422+
data = json.loads(serialized_data)
423+
task = Task(tiger, queue=queue, _data=data, _state=state,
424+
_ts=ts)
425+
tasks.append(task)
426426

427427
return n, tasks
428428

0 commit comments

Comments
 (0)