[Twisted-Python] Throttling outgoing client requests

Andrew Bennetts andrew-twisted at puzzling.org
Mon Sep 12 21:33:18 MDT 2005


On Mon, Sep 12, 2005 at 11:27:42PM -0400, Jp Calderone wrote:
[...]
> 
> ITYM,
> 
>    sem = DeferredSemaphore(10)
>    for job in joblist:
>        sem.run(job.run).addErrback(log.err)

I do, thanks.  I shouldn't send mail so late at night.

> Note that this isn't the ideal way to queue up a large number of jobs.  The 
> ideal way avoids constructing many more Deferreds than there are 
> outstanding jobs, as well as avoids adding more than a fixed number of 
> callbacks to each Deferred.

But is harder to code...

-Andrew.





More information about the Twisted-Python mailing list