[Twisted-Python] Graceful shutdown

2013-08-28 Thread Jonas Lindmark
Hi! I'm trying to implement graceful shutdown of a HTTP server and I am unsure of the preferred way of implementing it. I'm attempting to do this by adding a system event trigger for "before" "shutdown" that should stop accepting new requests and wait for current ones to finish. My problem is th

Re: [Twisted-Python] Graceful shutdown

2013-08-29 Thread Jonas Lindmark
Thanks for the link. Looking at your code I found the magic lines I was missing. Implementing my own HTTPChannel was the key to success. Now I don't have to poll reactor.getWriters() to see if there are unfinished writers. I ended up with something like this: class ApiHTTPChannel(HTTPChannel):