[Twisted-web] cancelling agent.request
johnaherne at rocs.co.uk
Sun Jan 15 05:05:57 EST 2012
On Sat, Jan 14, 2012 at 3:01 PM, <exarkun at twistedmatrix.com> wrote:
> On 10:18 am, johnaherne at rocs.co.uk wrote:
> >I have a situation where a service I am using will occasionally not
> >for considerable periods - hours not minutes.
> >I am using cooperate and yield to loop round a series of requests I
> >want to
> >The actual function to send the request returns a deferred to the
> >yield. I
> >add the callbacks onto this and set a calllater to fire in 30 seconds.
> >If that fires I can then cancel the deferred. But I think I ought to be
> >cancelling the request as well else I assume I will be leaking request
> >objects that might not get dealt with.
> >However, I can't see where I might cancel the request. Or should I be
> >dropping the connection associated with the request and if so where
> >would I
> >be doing that.
> >Have I got that right?
> The cancel method of the Deferred returned by Agent.request is probably
> the right API to use to do the cleanup you're interested in. However,
> cancelation is not specifically implemented for the Agent.request
> Deferred yet. Though it may sound like one, this is not a contradiction
> due to the way Deferred cancelation works (ideally we would have
> documentation about Deferred cancelation that would explain why this is,
> but we don't).
> See http://twistedmatrix.com/trac/ticket/4330 for progress on this issue
> or to contribute.
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
Thanks for the information.
I did take a look at the ticket. Not sure what I could contribute though.
But will take a closer look.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-web