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

RobRoy’s picture

Status: Needs review » Needs work

Could you roll a patch? That would help. Thanks.

See http://drupal.org/patch.

beginner’s picture

Version: 4.7.x-1.x-dev » 5.x-1.0

http://drupal.org/node/138165 is a duplicate of this one.

The notify module has started sending out notifications every single cron job on one of my web sites. I have installed the latest release (and dropped the previous table in order to install it cleanly) but it insists on sending out notification after notification of the same nodes. Previous behavior (in 4.7.x version) the notify module would notify only new node postings.

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?

mlncn’s picture

Version: 5.x-1.0 » 5.x-1.1

According to issue at 180052, multiple notifications still can occur.

Rhino’s picture

I have multiple notifications on every cron run. Sometimes only two, sometimes as many as eight.

RobertNelsonVance’s picture

I too have been experiencing similar issues as described at http://drupal.org/node/180052#comment-1108742

jwatte’s picture

I 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.

gisle’s picture

Status: Needs work » Closed (duplicate)