We are having an issue where the notification events are getting deleted while the item is still within the queue table. This is causing messages to go out without any notification event to reference. The symptom for this is that empty messages are getting sent.

I did some digging and noticed that the notifications_event_clean is not really robust in that it doesn't check the queue to make sure the event is within the queue before deleting.

A patch that fixes this problem will follow.

Thanks,

Travis.

Comments

travist’s picture

Status: Active » Needs review
StatusFileSize
new2.64 KB

Here is the patch.

christianchristensen’s picture

Status: Needs review » Needs work
+++ b/notifications.cron.incundefined
@@ -79,20 +79,56 @@ function notifications_process_prepare() {
+    // Get all the existing items within the queue.
+    $result = db_query("SELECT data FROM {queue} WHERE name='notifications_event'");
+    $queues = array();
+    while ($queue = db_fetch_object($result)) {
+      $queue->data = unserialize($queue->data);
+      if (isset($queue->data->node)) {
+        $nid = intval($queue->data->node->nid);
+        $queues[$nid] = $nid;
+      }
+    }
+
+    // Get all of the event items.
+    $result = db_query("SELECT * FROM {notifications_event}");
+    $events = array();
+    while ($event = db_fetch_object($result)) {
+      $event->params = unserialize($event->params);
+      $nid = intval($event->params['nid']);
+      $events[$event->eid] = $nid;

It may be worth considering wrapping this in a if module_exists('drupal_queue') or some other way to tell that notifications is using drupal_queue rather than it's defaults...

travist’s picture

Status: Needs work » Closed (won't fix)