How Often Should I Run This
Hi, my site has allows users to sign up and buy e-learning courses.
As soon as they purchase a course, they have 1 week (7 days) to START the course so the following is set as soon as the purchase has been made:
- $course_status is set to 'purchased'
- $start_timestamp is set (set to one week from the current time of the purchase)
I am running a cron job to check for courses that have not been started within the week (7 days) timeframe:
check all missions where $course_status = 'purchased'
IF $current_timestamp > $start_timestamp SET $course_status to 'not_started'
My question is, how many times should i be running this cron
a - run the cron 48 times a day (checking for courses that have not been started every 30 minutes throughout the day) (is this bad practice, would i be running the cron too often, with a possibility of slowing the site down)
b - should i add a $purchase_hour to the database and then run the cron every hour but only query courses where $purchase_hour = $current_hour (the hour at the time the cron is run)
Thanks in advance for your help on this
Why noit pick a cutoff time (Like 12AM) and run it once a day. That would reduce server load and you could have one uniform time. it would also be less for the customer to remember and people like simple.
Run it once a day at night to ensure less load on the server.
That wouldn't make sence, as some data could be 23 hours out of date
If you are giving people one week, is it that important as to be up-to-the-hour? And if it is, do 12hr increments or even 6.
Users are from different time zones and other information a lot more important than the corn I have mentioned needs to be up to date every hour as ther is financial stats involved
Ahh, didnt realize it was more than a 1 time charge. In that case, go with option b.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)