Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Due to timing issues, notify can send multiple notifications to the same user, if cron runs again while the first notification pass is going out. Modified the _cron hook as follows:
function notify_cron() {
if (variable_get('notify_lock', false)) {
watchdog('notify', 'Notify is still locked!');
} else {
variable_set('notify_lock', true);
if (time() - variable_get('notify_send_last', 0) > variable_get('notify_send', 86400)) {
_notify_send();
variable_set('notify_send_last', time());
}
variable_set('notify_lock', false);
}
}
Please add back to the main code.
Comments
Comment #1
RobRoy CreditAttribution: RobRoy commentedCould you roll a patch? That would help. Thanks.
See http://drupal.org/patch.
Comment #2
beginner CreditAttribution: beginner commentedhttp://drupal.org/node/138165 is a duplicate of this one.
what is puzzling is that with D5, the core cron function has been improved, to avoid having multiple instances of cron running, thereby duplicating the job.
If this bug really still existed in D5, more people would have reported it.
@mikegull : do you still experience this problem with D5?
@Shane: do you?
Comment #3
mlncn CreditAttribution: mlncn commentedAccording to issue at 180052, multiple notifications still can occur.
Comment #4
Rhino CreditAttribution: Rhino commentedI have multiple notifications on every cron run. Sometimes only two, sometimes as many as eight.
Comment #5
RobertNelsonVance CreditAttribution: RobertNelsonVance commentedI too have been experiencing similar issues as described at http://drupal.org/node/180052#comment-1108742
Comment #6
jwatte CreditAttribution: jwatte commentedI think the logic is worse than that, unfortunately, and I think the proposed patch is just a band-aid.
I'm proposing a different patch.
Comment #7
gisleDuplicate of:
In principle, the fix should be backported to the 5.x-branch, but that is not going to happen.