[Twisted-Python] How to safely stop a chain of deferreds

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Jun 28 13:37:45 EDT 2011


On 01:30 pm, tomw at ubilix.com wrote:
>Hi,
>
>in a GUI application I'm using quite a comprehensive chain of deferreds
>and I'm running the mainloop from the glib2reactor. At a certain point
>of my application I need to terminate the entire chain of deferreds to
>make sure that no more data is loaded and processed. Stopping the
>reactor does not work as the entire GUI would terminate, too. I tried 
>to
>cancel the first deferred, hoping that the cancel event will be
>forwarded to the next deferred in the chain or at least invoke an
>errback, but for some reason it does not work and the deferreds seem to
>run forever. Any ideas on how to solve this issue?

What would you do if you had this non-Deferred using code:

    x = a()
    y = b(x)
    z = c(y)

and you decided in b that you need to terminate your data loading and 
processing?

Jean-Paul



More information about the Twisted-Python mailing list