port to twisted

George Schlossnagle <[email protected]> Fri, 26 Mar 2004 17:05:29 -0500
Newsgroups gmane.comp.web.mod-pubsub.devel
Message-ID <[email protected]>
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



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click