| Backoffice skin switching » |
There are quite a few actions that need to or should be performed asynchronously. These include:
The plan is to have a table named T_schedule which would store all actions to be performed.
Then there would be a special script like /htsrv/async.php that should be called periodically (either with cron or with a website watchdog service). Typically once every minute.
This script should take an optional password as a parameter to prevent unwanted flooding.
Of course, the script could also be run manually, from a "schedule" tab in the backoffice that would display a neat list of things to come...
The script would look at the next action to do in T_schedule and do the job then report it done.
Typically the fields in the table would be:
The main issue here are transactions. In an INNO_DB mysql (i-e WITH transactions) you can make sure that you start the next pending task only if it has passed start_at time and it's still 'pending', then put it into 'running' mode before any other instance of async.php tries to execute it).
Without transactions you're kinda screwed! We could workaround this by creating a second table called T_schedule_hanlder with an Primary Key were we would store the ID of the task we plan to execute; if we can insert it without error, then we know we're the first trying to do the task.