[EMAIL PROTECTED] wrote:
The mods are classes likeclass module(resource.Resource): def render_GET(self, request): # do something The reactor is started as: reactor.listenTCP(_port, server.Site(root)) reactor.run( ) Some of the GET request in the mods can take some time to complete. In the current situation other request to the server have to wait on this request. Is it possible to make soms kind of a thread/connection pool so that more then one request can be handled at the same time?
That wouldn't be very twisted :). Ideally your "# do something" code could quickly return a deferred which would fire when the result is ready. (I think it's a bit more complicated than just 'return my_deferred', but not much.)
If the requests are spending time waiting for database requests, for example, you could use a non-blocking deferred API to the database. Worst case, if the delay is due to something that you really need to multi-thread, you could use t.i.threads.deferToThread on just that section. Then twisted would use a thread pool for the parts that need it and connect the rest of your code into the deferred event style.
_______________________________________________ Twisted-web mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
