[Twisted-Python] (no subject)

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? If this has been covered in the past, please point me in that direction. :-) Regards, Mattias

Hello 2008/8/12 Mattias Brändström <mattias.brandstrom@todos.se>:
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 one). Excuse my poor english. Regards, Javi

OK. This seems like a good approach. However, I am using twisted.web.server.Site as my factory and the resources tied to my Site instance are the ones that need to access the server configuration. How would I go about giving each request its own configuration reference in this case? I'm quite new to twisted and it's not entirely clear to me how to achieve this. :-) :.:: mattias

Hello 2008/8/12 Mattias Brändström <mattias.brandstrom@todos.se>:
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 one). Excuse my poor english. Regards, Javi

OK. This seems like a good approach. However, I am using twisted.web.server.Site as my factory and the resources tied to my Site instance are the ones that need to access the server configuration. How would I go about giving each request its own configuration reference in this case? I'm quite new to twisted and it's not entirely clear to me how to achieve this. :-) :.:: mattias
participants (2)
-
lasizoillo
-
Mattias Brändström