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

Forum cron sends duplicate digest emails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a bug
    • Affects Version/s: 1.9.5, 2.3.6, 2.6.4
    • Fix Version/s: None
    • Component/s: Forum
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_23_STABLE, MOODLE_26_STABLE

      Description

      The forum_cron() function sends digest emails at the configured time and once all emails are sent it updates the 'digestmailtimelast' config setting to indicate when it last ran. In large deployments where most users have digest enabled (eg. ~10k users), the sending of digest emails can take longer than 5 minutes. If another cron process starts up before the 'digestmailtimelast' setting is updated, it will begin sending duplicate digest emails. Depending on how long the sending takes, there can be 2, 3, or more copies of digest emails sent.

      My attached patch works around this problem by updating 'digestmailtimelast' before beginning to send. Potentially this could cause digests to be lost if the cron process was killed before all emails were sent, but at the moment I'm running this code as its better than having the duplicates. A more robust solution might require each record in the forum queue to be marked as the email gets sent.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                13 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: