Skip to content
Some examples of how the Twisted Deferred class' chainDeferred might be improved
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Here are some commented examples of how the chainDeferred method in
Twisted's Deferred class can be a bit surprising, or cause errors, or
perhaps even dangerous (not calling cancel on chained deferreds).

There's an alternate Deferred class in that shows one way we
might go about addressing these issues. Note that it's not suggested as a
perfect solution, just a possible direction. Deferreds are complicated and
the class probably gets things wrong in some cases. So
is just a pointer to how we might do things, intended to start discussion.
( is based on Twisted 10.1)

To run an example using normal deferreds, invoke it using Python from the
command line. E.g.,

    $ python
    cancel one
    cancelled one

To run with add an argument (anything at all):

    $ python xxx
    cancel one
    cancelled one
    cancel two
    cancelled two

Terry Jones
Something went wrong with that request. Please try again.