[Twisted-Python] succeedForOneOf

Justin Johnson justinjohnson at gmail.com
Thu Jan 20 11:24:12 EST 2005


I wrote succeedForOneOf to help when I want to loop through a list and
call a function with the item from the list as the first argument to
the function, and stop when one of the function calls succeeds.  The
use case I need it for is, connecting to multiple servers looking for
a particular thing, and stopping when I find it.

In my testing in the attached file, succeedForOneOf does what I would
expect.  However, when I tried this in my application, and func
involved connecting to servers via PB and calling a remote method, it
started up a ton of 'PBClientFactory's until the win32eventreactor
spun wildly out of control because I exceeded the 64 object
limitation.  This of course also caused the server I was connecting to
to spin wildly out of control as well, sucking up all of the CPU.

My question isn't related to the win32event reactor problem.  I just
don't understand why my implementation of succeedForOneOf would fail
in this manner.  Does anyone see a problem with the code?  Has someone
else written code to accomplish this in a different way?

-Justin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sfoo.py
Url: http://twistedmatrix.com/pipermail/twisted-python/attachments/20050120/8ede8710/attachment.txt 


More information about the Twisted-Python mailing list