dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: How Often Should I Run This

  1. #1
    Join Date
    Jul 2006
    Posts
    663

    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'
    ELSE
    do nothing

    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

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    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.

  3. #3
    Join Date
    Feb 2012
    Posts
    7
    Run it once a day at night to ensure less load on the server.

  4. #4
    Join Date
    Jul 2006
    Posts
    663
    That wouldn't make sence, as some data could be 23 hours out of date

  5. #5
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    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.

  6. #6
    Join Date
    Jul 2006
    Posts
    663
    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

  7. #7
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    Ahh, didnt realize it was more than a 1 time charge. In that case, go with option b.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles