[Twisted-Python] Deferred execution, timeouts, and unhandled exceptions
Bob Ippolito
bob at redivi.com
Sat Jan 18 12:43:00 MST 2003
On Saturday, Jan 18, 2003, at 07:57 America/New_York, Andrew Bennetts
wrote:
> On Sat, Jan 18, 2003 at 11:26:38PM +1100, Andrew Bennetts wrote:
>> On Fri, Jan 17, 2003 at 07:04:01PM -0500, Bob Ippolito wrote:
>>> I've noticed that there isn't really a good/standard way to do
>>> timeouts
>>> (without bad things happening) or cancel deferreds in Twisted
>>> [without
>>> subclassing everything you use, which isn't good in my book].
>>
>> I've glanced at your code and log, but it's not immediately clear to
>> me what
>> the problem is...
>
> For that matter, perhaps another solution would be to mandate that a
> method
> creating a Deferred is responsible for configuring it with an errback
> that
> will cancel pending operations so that .callback won't be called.
That's exactly what I am proposing! :)
Look at the class "DoesHandleTimeoutsByItself" -- that's exactly what
it does, register an errback to a method such that it can cancel what
it's doing so that it never tries to do a callback or another errback.
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.
-bob
More information about the Twisted-Python
mailing list