Fixes the bug where the wrong result is returned when a chain contains a chord as the penultimate task. https://github.com/celery/celery/issues/2228
@@ -473,9 +473,9 @@ class chain(Signature):
if link_error:
task.set(link_error=link_error)
- if not isinstance(prev_task, chord):
- results.append(res)
- tasks.append(task)
+ tasks.append(task)
+ results.append(res)
+
prev_task, prev_res = task, res
return tasks, results