Thanks for the suggestion Etienne. I couldn't come up with anything that worked with SCGI, but you did get me thinking about some other options for getting my scheduled methods working. What I ended up doing was taking the twisted_http.py implementation to serve my app. For the scheduled method I used callLater method from twisted.internet.reactor. It's as easy as putting this into my event loop: reactor.callLater(600, shedmethod) The method then schedules itself by making another call to reactor.callLater. So far it's working out great. The side-effect of using Twisted to serve your app (I imagine it's the same with Medusa) is that you have be careful of any code that blocks, like file I/O or database calls. I had to refactor some of these spots in my app. Other than that everything works good with Twisted. I'm still trying to grok the event-based way of doing things though. - Jeff On Thursday 31 July 2003 01:05 am, Etienne Posthumus wrote: > On Wed, 30 Jul 2003, Jeff Koncz wrote: > > Where is the best place to put in some code for calling a scheduled > > method? > >> > > I need to call this thing every 10 minutes. I'll use some sort of loop > > with time.sleep(600) to get my interval, so no problem there. I'm just > > not sure where to put this type of code in the application. It needs to > > run in the same process as my Quixote app. I use SCGI to serve it so I'm > > thinking I could override main() in scgi.quixote_handler and then put my > > scheduled method code in there. Is that a good approach? Any other > > ideas? > > I use Medusa, and in there I made my own loop() method in stead of using > the asyncore.loop. It does exactly the same thing as the asyncore.loop, > but each trip round the loop after falling out of the select call, it > checks a dict of 'scheduled' methods. > If any of the methods scheduled times are < time(), they are executed. > > I add methods to be scheduled using a later() method in which I specify > the method, args and time in the future to be called. > > Oh yes, the timeout for the select is 0.01. > Not sure if a similar approach is possible in SCGI as I haven't used it > yet. What I like about Medusa is that I don't have to worry about any > threading issues for the called methods