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

Forum digests may not be sent to a user if new posts made near to the digest send time

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_311_STABLE
    • MOODLE_310_STABLE, MOODLE_311_STABLE
    • MDL-72767-m310
    • MDL-72767-m311
    • Hide

      Automatic tests cover task processing

      Upgrade

      Pre-requisites

      • A version of Moodle without this patch applied
      • Task processing disabled
        1. Navigate to Site administration > Server > Tasks > Task processing
        2. Uncheck Enable cron and then save
      • A user (User 1) who is set to receive daily digests
        1. Navigate to their profile
        2. Click on Preferences then Forum preferences
        3. Set Email digest type to Complete (daily email with full posts)
        4. Save changes
      • A course (Course 1)
      • User 1 is enrolled on Course 1 as a Teacher
      • Ensure that the Hour to send digest emails (digestmailtime) setting is well in the future or the past.

      Steps

      1. Login as User 1
      2. Navigate to the Announcements forum in Course 1
      3. Press Add a new topic then Advanced
      4. Create a message ensuring that Send forum post notifications with no editing-time delay is checked
      5. From the command line run: php admin/cli/scheduled_task.php --execute=\\mod_forum\\task
        cron_task
      6. In the database look at the task_adhoc table and record details of all the tasks with the \mod_forum\task\send_user_digests classname
      7. Upgrade Moodle to a version with this patch
      8. In the database verify that in the task_adhoc table that all the \mod_forum\task\send_user_digests classname rows have had their customdata changed from blank, but that other details are identical.
      9. Navigate to the Announcements forum in Course 1
      10. Press Add a new topic then Advanced
      11. Create a message ensuring that Send forum post notifications with no editing-time delay is checked
      12. From the command line run: php admin/cli/scheduled_task.php --execute=\\mod_forum\\task
        cron_task
      13. Verify that no new tasks have been created in the database.
      Show
      Automatic tests cover task processing Upgrade Pre-requisites A version of Moodle without this patch applied Task processing disabled Navigate to Site administration > Server > Tasks > Task processing Uncheck Enable cron and then save A user (User 1) who is set to receive daily digests Navigate to their profile Click on Preferences then Forum preferences Set Email digest type to Complete (daily email with full posts) Save changes A course (Course 1) User 1 is enrolled on Course 1 as a Teacher Ensure that the Hour to send digest emails (digestmailtime) setting is well in the future or the past. Steps Login as User 1 Navigate to the Announcements forum in Course 1 Press Add a new topic then Advanced Create a message ensuring that Send forum post notifications with no editing-time delay is checked From the command line run: php admin/cli/scheduled_task.php --execute=\\mod_forum\\task cron_task In the database look at the task_adhoc table and record details of all the tasks with the \mod_forum\task\send_user_digests classname Upgrade Moodle to a version with this patch In the database verify that in the task_adhoc table that all the \mod_forum\task\send_user_digests classname rows have had their customdata changed from blank, but that other details are identical. Navigate to the Announcements forum in Course 1 Press Add a new topic then Advanced Create a message ensuring that Send forum post notifications with no editing-time delay is checked From the command line run: php admin/cli/scheduled_task.php --execute=\\mod_forum\\task cron_task Verify that no new tasks have been created in the database.

    Description

      In a scenario where the digest time has passed, but the adhoc task for sending a digest has not yet been processed it is possible for things to happen that will cause the digest mail to not be sent for that day.

      The assumptions are that:

      1. It is after the digest time for the day
      2. There is a digest adhoc task that has not yet been processed for the day
      3. A new post has been made on a forum the user is on

      When the post is processed by the forum scheduled task for the user with the digest the following happens:

      1. The new message is added to the forum message queue
      2. The time for the digest is calculated as being the next day
      3. A new digest task is sent via \core\task\manager::reschedule_or_queue_adhoc_task();
      4. Since there is already an existing task rather than creating a new one it changes the run time on the existing task to be the next day.

      This results in the user not being sent a digest for the current day, if unlucky this could happen indefinitely for a user.

      I would expect that one of the following things should happen in this scenario:

      1. No change is made to the run time of the digest task (if it will process all the posts in the queue, even if they are after the digest time for the day)
      2. A new task is added for the next day.

      As an example of how this is impacting us:

      • Our digest time is set to be 6pm.
      • Yesterday at 3pm we had 9100 digests scheduled to be sent
      • This morning we had 141 digest adhoc tasks that were created yesterday before the digest time that now have a runtime of today.
      • It looked like it took us over an hour to process all the forum digest adhoc tasks, since the earliest posts after the digest time for the users affected were:
        • 6:06pm
        • 6:18pm
        • 7:05pm

      This means it is likely that 141 users did not get a daily digest yesterday.

      Attachments

        Activity

          People

            nmagill Neill Magill
            nmagill Neill Magill
            Joseph Baxter Joseph Baxter
            Andrew Lyons Andrew Lyons
            Gladys Basiana Gladys Basiana
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/Nov/21

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 20 minutes
                1h 20m