[Twisted-Python] (no subject)

lasizoillo lasizoillo at gmail.com
Fri Aug 15 12:21:56 EDT 2008


2008/8/12 Mattias Brändström <mattias.brandstrom at todos.se>:
> Hello!
> Is there any way I can make twisted stop accepting connections for a short period of time and then start accepting connections? Something like reactor.pause()?
> More precisely, what I want to do is to reread my server configuration on SIGHUP (or some other external event). If possible I would like to do this without locking a mutex when accessing (reading or modifying) the configuration info. I figure that reconfiguring the server will be a rare event. So if there is some way that I can:
> 1. Block incoming requests. Preferable keeping them in the connection queue.
> 2. Wait for all running requests to complete.
> 3. Reread the server configuration.
> 4. Unblock incoming requests.
> What do you think? Is there some simple twisted-way to do this?
It's really necesary do that?

1 Your app have a reference to a object whith the loaded config
2 A defered take a reference to these object
3 A reread event change the app config reference to new loaded config
object. Old defered no change his reference and end whith old config.
4 New defereds take new config and reference that.
5 When old config object have not references is garbaged collected.

No blocking operation is nedded if you can load 2 configuration
objects in memory (the old one for connections in progress and the new

Excuse my poor english.



> If this has been covered in the past, please point me in that direction. :-)
> Regards,
> Mattias
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list