[Twisted-Python] (no subject)
![](https://secure.gravatar.com/avatar/3a028a7a7bf33082d9bfc654078dc074.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/3a028a7a7bf33082d9bfc654078dc074.jpg?s=120&d=mm&r=g)
Ops. I missed the subject. This should make things a little crearer.
-----Ursprungligt meddelande----- Från: twisted-python-bounces@twistedmatrix.com [mailto:twisted-python- bounces@twistedmatrix.com] För Mattias Brändström Skickat: den 12 augusti 2008 17:57 Till: twisted-python@twistedmatrix.com Ämne: [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
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
![](https://secure.gravatar.com/avatar/b38884a7a19aa642a694004cc2a0432a.jpg?s=120&d=mm&r=g)
Hello 2008/8/12 Mattias Brändström <mattias.brandstrom@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 one). Excuse my poor english. Regards, Javi
If this has been covered in the past, please point me in that direction. :-)
Regards, Mattias
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
![](https://secure.gravatar.com/avatar/3a028a7a7bf33082d9bfc654078dc074.jpg?s=120&d=mm&r=g)
-----Ursprungligt meddelande----- Från: twisted-python-bounces@twistedmatrix.com [mailto:twisted-python- bounces@twistedmatrix.com] För lasizoillo Skickat: den 15 augusti 2008 18:22 Till: Twisted general discussion Ämne: Re: [Twisted-Python] (no subject)
Hello
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
2008/8/12 Mattias Brändström <mattias.brandstrom@todos.se>: 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 one).
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