Moodle

Forum cron sends duplicate digest emails

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: Forum
  • Labels:
  • Affected Branches:
    MOODLE_19_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.

Activity

Hide
Xavier Paz added a comment -

I can confirm this also happens with Moodle 1.9.7+ (Build: 20100106) . I programmed cron each 10 min. and It sent the same digest four times to 300 users.

Show
Xavier Paz added a comment - I can confirm this also happens with Moodle 1.9.7+ (Build: 20100106) . I programmed cron each 10 min. and It sent the same digest four times to 300 users.
Hide
Michael Blake added a comment -

This issue has been reported to affect MP clients. Please give it priority.

Show
Michael Blake added a comment - This issue has been reported to affect MP clients. Please give it priority.

People

Vote (10)
Watch (3)

Dates

  • Created:
    Updated: