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

log live report misses records when polling based on timecreated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.11.7
    • 3.9.12, 3.10.9, 3.11.5, 3.11.6, 4.0
    • Reports
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-73948-master-v4
    • Hide

      Install this plugin to help testing:

      https://github.com/catalyst/moodle-tool_testtasks

      1) Set this in config.php

      define('REPORT_LOGLIVE_REFRESH', 6);

      2) Load this page and leave it open, it will emit a constant stream of events with a 2 second delay between when the event was created vs when it was flushed

      /admin/tool/testtasks/events.php?delay=2

      Leave this page open until a handful of events have been triggered

      3) Start another session (eg in incognito mode) and access the live logs report page /report/loglive/index.php

      4) Confirm that you can see the handful of events already triggered

      5) Wait and confirm that you see new events coming every few seconds and that the events coming through are in ascending order with no gaps in the sequence. i.e. you won't have missing records like

      	Spam number 13021 delay 2
      	Spam number 13023 delay 2
      

      Show
      Install this plugin to help testing: https://github.com/catalyst/moodle-tool_testtasks 1) Set this in config.php define('REPORT_LOGLIVE_REFRESH', 6); 2) Load this page and leave it open, it will emit a constant stream of events with a 2 second delay between when the event was created vs when it was flushed /admin/tool/testtasks/events.php?delay=2 Leave this page open until a handful of events have been triggered 3) Start another session (eg in incognito mode) and access the live logs report page /report/loglive/index.php 4) Confirm that you can see the handful of events already triggered 5) Wait and confirm that you see new events coming every few seconds and that the events coming through are in ascending order with no gaps in the sequence. i.e. you won't have missing records like Spam number 13021 delay 2 Spam number 13023 delay 2

      Currently, log live report polls new records with a condition timecreated > :date https://github.com/moodle/moodle/blob/0f94f2929606559cc7a07387aca1bb0c1030e8d5/report/loglive/classes/table_log.php#L318 where :date is the last poll time https://github.com/moodle/moodle/blob/0f94f2929606559cc7a07387aca1bb0c1030e8d5/report/loglive/classes/table_log_ajax.php#L50 .

      This breaks the report when using logstores that are designed to queue entries and then insert them in batches. Eg https://github.com/catalyst/moodle-logstore_standardqueued

      I believe there also may be an edge case with logstore_standard when a record was inserted with a delay due to high load, so its timecreated would be less than until and therefore it wouldn't be displayed by the report.

      It seems like this can be addressed by polling records by id instead of timecreated.

        1. image-2022-03-08-21-42-33-945.png
          33 kB
          Brendan Heywood
        2. screenshot-1.png
          575 kB
          Misha Golenkov
        3. screenshot-2.png
          763 kB
          Misha Golenkov
        4. MDL-73948_master.png
          164 kB
          Angelia Dela Cruz
        5. MDL-73948_311.png
          203 kB
          Angelia Dela Cruz

            mikhailgolenkov Misha Golenkov
            mikhailgolenkov Misha Golenkov
            Brendan Heywood Brendan Heywood
            Ilya Tregubov Ilya Tregubov
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 40 minutes
                40m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.