Google App Engine, Best Way To Schedule Code Execution
Problem: some users can create a document, and choose date and time in the future, for the execution of some code on that document. The users can also cancel that scheduled event.
Solution 1:
Because your users can schedule an event as well as cancel - I would recommend saving the scheduled request to the datastore and have a cron job check if there is anything scheduled at that time.
To reduce the number of times the job runs, you can change the precision of the date/time a user can select for the job (such as 15 minute increments, or hourly). As long as you construct the scheduled request entity properly - it shouldn't be an expensive hit to the datastore. To reduce datastore hits, you can fetch a range of upcoming scheduled events in one query and put them in memcache - as long as you manage that cache when a user modifies one.
Post a Comment for "Google App Engine, Best Way To Schedule Code Execution"