[Twisted-Python] defer.gatherResults & Deferreds chaining

Glyph glyph at twistedmatrix.com
Mon Jul 29 17:04:26 MDT 2013


On Jul 29, 2013, at 1:29 PM, Jorge Gonzalez <gjorge at google.com> wrote:

> Wouldn't it be possible that defer.gatherResults inserts its callback into d before say slowFuncReturningDeferred_B gets to run and return its own Deferred (and therefore chain it to what gatherRestults is ultimately waiting for?). If so, wouldn't the results returned by slowFuncReturningDeferred_B never make it to the results gathered by defer.gatherResults?

No, that's not what happens.  You call addCallback(lambda _: slowFunc...A()), then you call gatherResults.  That means gatherResult's callback is after slowFuncReturningA() in d's callback chain.

Can you attach an actual runnable code example with some behavior that you didn't expect, so we can actually run it and explain what's happening?  No need for you to spin the reactor or anything, just instantiate a Deferred and then fire it.

-glyph


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130729/6679d3b0/attachment.html>


More information about the Twisted-Python mailing list