[Twisted-Python] Deferred execution, timeouts, and unhandled exceptions
glyph at twistedmatrix.com
Sat Jan 18 19:14:10 EST 2003
On Sat, 18 Jan 2003 14:43:00 -0500, Bob Ippolito <bob at redivi.com> wrote:
> What bothers me most isn't that an exception is being raised, but that it is
> impossible to reasonably catch that exception unless you subclass or
> otherwise do some nasty modifications to the reactor, deferred, or whichever
> class causes the exception.
I believe that I expressed concerns when setTimeout was originally proposed,
noting that only the system firing the callback can reasonably terminate
whatever process is doing the callback.
The meaning of "cancel" is domain-dependant, so if we want a general way of
doing this then we need a way to express cancellation in the code which expects
to be calling the callback. I think that the system that calls the callback is
usually the one that creates the Deferred, so perhaps we could have an optional
argument to the constructor, cancelCallback.
I can't help but feel this is a really ugly corner case, which would be
inconvenient to effectively force everyone who uses a Deferred to implement in
order for setTimeout to be callable. However, I don't have any better ideas.
My original plan here was to always put timeouts somewhere else besides a
Deferred, and have the system that calls the deferred call an errback at that
point (such as with the "timeout" argument to connectTCP).
Another interesting case: what if two people call setTimeout on the same
Deferred? If it's not purely the creator's responsibility to set the timeout
on a Deferred, then what do we do about conflicts between different points in
the processing chain?
| <`'> | Glyph Lefkowitz: Travelling Sorcerer |
| < _/ > | Lead Developer, the Twisted project |
| < ___/ > | http://www.twistedmatrix.com |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030118/50c36457/attachment.pgp
More information about the Twisted-Python