Skip to content

Commit 419a780

Browse files
committed
process_parallel was leaking the failures on its internal deferreds. closes scrapy#458
DeferredList implemented cancellation in Twisted 13.2.0 by holding a reference to the affected deferreds objects, if a deferred errored the result was propagated to the DeferredList but still referenced by the original deferred and nobody was consuming it. The tests started to fail because the reference from DeferredList prevented the underlining deferred from been collected before the test finish invalidating the effect of self.flushedLoggedErrors() call.
1 parent 4f7ad36 commit 419a780

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scrapy/utils/defer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def process_parallel(callbacks, input, *a, **kw):
8282
callbacks
8383
"""
8484
dfds = [defer.succeed(input).addCallback(x, *a, **kw) for x in callbacks]
85-
d = defer.gatherResults(dfds)
86-
d.addErrback(lambda _: _.value.subFailure)
85+
d = defer.DeferredList(dfds, fireOnOneErrback=1, consumeErrors=1)
86+
d.addCallbacks(lambda r: [x[1] for x in r], lambda f: f.value.subFailure)
8787
return d
8888

8989
def iter_errback(iterable, errback, *a, **kw):

0 commit comments

Comments
 (0)