From: George S. <ge...@om...> - 2004-03-26 22:03:50
|
Hi, Joyce Park has been talking to me about porting mod_pubsub to use the twisted event framework. I've done some poking around and wanted to share some assessments before I start work in earnest: In your main event loop, you currently do this: while server.alive: asyncore.poll(scheduler.timeout()) scheduler.run() which basically polls with a timeout equal to the minimum time of any scheduled event, handles those, and then does a linear search through the entire list of scheduled events looking for ones which are runnable. Having to do a linear search though the scheduled event list is relatively slow, prone to race conditions, and I can't think of a good reason that it shouldn't be handled internal to the event system. In moving to twisted, I would like to pull the scheduled events into the twisted system itself, using the twisted reactors native support for time-scheduled events. Actual implementation aside, is their any reason I'm missing as to why this is a bad idea? I have a partial port running that incorporates this functionality with twisted and it works well. George |