Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46133

Event monitor: Implement cron task to clean events table

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.8
    • Component/s: Reports
    • Labels:
    • Testing Instructions:
      Hide
      Test 1
      1. Run all the tests in admin/tool/monitor/tests/task_clean_events_test.php.
      Test 2
      1. Visit a course.
      2. Visit 'Course administration' -> 'Reports' -> 'Event monitor' -> 'Manage rules'.
      3. Add a few rules (remember the events you chose) and set the field 'in minutes' to 10.
      4. Go to the course and perform numerous actions, including those required to trigger the events you select earlier (add a bunch of different activities, view them, perform actions - we basically want to trigger a lot of events).
      5. View the content of the table 'tool_monitor_events' and ensure there are a bunch of events that you created.
      6. Run the cron.
      7. View the table again and check that all the events not associated with the ones you chose on the management rule page are gone.
      8. Wait over 10 minutes and run the cron again.
      9. Check that the table is empty.
      Show
      Test 1 Run all the tests in admin/tool/monitor/tests/task_clean_events_test.php. Test 2 Visit a course. Visit 'Course administration' -> 'Reports' -> 'Event monitor' -> 'Manage rules'. Add a few rules (remember the events you chose) and set the field 'in minutes' to 10. Go to the course and perform numerous actions, including those required to trigger the events you select earlier (add a bunch of different activities, view them, perform actions - we basically want to trigger a lot of events). View the content of the table 'tool_monitor_events' and ensure there are a bunch of events that you created. Run the cron. View the table again and check that all the events not associated with the ones you chose on the management rule page are gone. Wait over 10 minutes and run the cron again. Check that the table is empty.
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-46133_master
    • Story Points:
      20
    • Sprint:
      BACKEND Sprint 17

      Description

      Implement a cron task to clean tool_monitor_events periodically.

      There are three ways do this:-

      1. Truncate the table unconditionally every x hours
      2. Implement a smart logic that reads various rules and finds which event entries are not useful any more and dumps them only.
      3. Implement a semi -smart logic which finds out the maximum "timewindow" used in rules and dumps every thing beyond that.

      Imho, 1 is not acceptable, 2 seems ideal, 3 is easiest to implement and more performance friendly than 2.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              ankit_frenz Ankit Agarwal
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Sam Hemelryk
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14