Graham Dumpleton
grahamd at dscpl.com.au
Sat Nov 18 16:07:51 EST 2006
On 18/11/2006, at 11:37 PM, Seb wrote: >> >> how about creating a cron entry that create a http request? > > I would like to implant the scheduler inside the python site. I don't > know where my project can be hosted, and if I'll have the access to > crontab.. > >> > >> > You could fork another process. >> >> You can use the PythonImport directive to have a specific module >> imported >> at the time that the Apache child process is created and prior to any >> actual >> request having been received. From this you could create a new >> thread to >> perform some periodic task. >> >> >> BTW, what exactly is it that you want the thread to do? > > Thanks for the information, I think I'll look on this way. > My goal is to create a persistent game with html acces. I need to > update the world periodicly, and not to wait that a user upload a page > for checking and launch all the tasks. Each tasks will be counted as a > thread, wich can be update for the game, mail on the intern mail > service, saves and more... > Before coding anything, I would like to be sure that what I want to do > is realizable.. You are going to be much better off using a separate persistent process which sits behind Apache for this, using something like XML-RPC to communicate between the HTTP request handlers running in Apache and the backend process. This will be easier as then you do not have to deal with issue of how you are going to maintain your game state so all Apache child processes can access it and update it as it will all be done from one process rather than many. The problem of dealing with the fact that Apache child processes can be shutdown or die at any time is also less as the real work is being done in the backend server and it will always be running. Graham
|