SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2011
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Why are you needing to check this?

    The only reason you'd run a cron for something like this, is to notify the user that their time frame is expiring soon.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2011
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes that is exactly what i need to do


Bookmarks

Posting Permissions

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