[Twisted-Python] Throttling a web2 server

Cameron Dale camrdale at gmail.com
Thu Feb 28 15:34:34 EST 2008

On 2/27/08, Thomas Hervé <therve at free.fr> wrote:
> Thanks. Some maintenance on this would be great.

I'm not sure what you mean, is there some current maintenance (e.g.
more comments) you think should be added now? or do you refer to
future maintenance in case things break?

> I haven't very closely at your patch, but there is definitely
>  something missing: tests. It's a requirement for anything going into
>  Twisted, and generally a requirement for making something works.

Attached is a patch to twisted.test.test_policies.py to work with the
modified policies.py. In preparing it, I did fix one bug in my
previous policies.py which caused the write limiter to always be
active, so I attach an updated (fixed) patch of policies.py.

One thing I found in the tests is that the resumeProducing() calls
that my modified policies.py schedules via reactor.callLater() are
never called. This is (I believe) an artifact of the test, as the test
uses the twisted.internet.task.Clock's advance function, which only
runs scheduled calls added to it and not the reactor. Being unfamiliar
with twisted's testing framework, and having spent FAR too much time
on this already, I was not able to modify the test to work properly
with the reactor.callLater's, so I commented out those parts of the

>  The discussion should probably continue in the tracker. You can open a
>  ticket, or maybe attach your patch at
>  http://twistedmatrix.com/trac/ticket/1460 (which doesn't exactly
>  describe the same goal).

Noted, though I prefer email.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_policies.py.patch
Type: text/x-diff
Size: 1550 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20080228/dd4955f5/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: policies.py.patch
Type: text/x-diff
Size: 7651 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20080228/dd4955f5/attachment-0001.patch 

More information about the Twisted-Python mailing list