[Twisted-Python] Looping

Andy Fundinger Andy at newworldelectric.com
Mon Jan 5 08:34:58 EST 2009


>
>
> > Is there a reason why you're using just one deferred?
> What is the advantage of using more?
>

If you use more with a DeferredList you can have [effectively] parallel page
fetches.  It's like spawning threads for each page, but twisted doesn't
actually spawn threads for this I don't think.  The net effect is pretty
much the same since it will send out all the requests before the replies
come in and then handle all of them as they come in.  Especially, for a
system reading multiple websites, if two or more are down in a DeferredList
your system will overlap the timeout periods rather than waiting them out
sequentially.

-Andy

-- 
Blog:  http://channel3b.wordpress.com
Second Life Name:  Ciemaar Flintoff

How could you possibly think typing 'import skynet' was a good idea?
http://xkcd.com/521/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090105/940f263d/attachment.htm 


More information about the Twisted-Python mailing list