Folks, I am a little confused, and I haven't been able to find anything in the Twisted docs regarding this? pool = threadpool.ThreadPool () root = Resource () root.putChild ("resources", File( server_root + os.sep + "resources") ) root.putChild ("thumbnails", File( server_root + os.sep + "thumbnails") ) root.putChild ("templates", File( server_root + os.sep + "templates") ) root.putChild ("albums", Gallery() ) factory = Site ( root ) print "Listening on Port 8888..." reactor.listenTCP ( 8888, factory) reactor.run() I can't find how to add a ThreadPool to a standard reactor? And how can I check or set Keep alive for the TCP connections? Can anyone point me in the right direction? - Benjamin
On 06/11/2013 11:53 PM, Benjamin Schollnick wrote:
I can't find how to add a ThreadPool to a standard reactor?
I think you might be confused about what ThreadPool does. It doesn't magically use threads for Twisted work - Twisted is single-threaded, and does all it's work in one thread (except for adbapi and a few edge cases) The ThreadPool is for *your* code. It won't do anything unless you call deferToThreadPool or similar.
And how can I check or set Keep alive for the TCP connections?
transport.setTcpKeepAlive - see here: http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.I...
Hi Benjamin, You create a thread pool, but don't do anything with it. For what it's worth, it doesn't seem like the rest of your example, being simple twisted.web resources, would require a thread pool at all :) What would you like to achieve with said thread pool? cheers lvh
participants (3)
-
Benjamin Schollnick
-
Laurens Van Houtven
-
Phil Mayers