Notify.php
authorAlan Knowles <alan@akbkhome.com>
Fri, 3 Feb 2012 02:40:27 +0000 (10:40 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 3 Feb 2012 02:40:27 +0000 (10:40 +0800)
Notify.php

index 41d6520..3d5673f 100644 (file)
@@ -131,12 +131,13 @@ class Pman_Core_Notify extends Pman
         }
         
         
-        
+        $pushed = array();
         while (true) {
             if (empty($ar)) {
                 break;
             }
             
+            
             $p = array_shift($ar);
             if (!$this->poolfree()) {
                 array_unshift($ar,$p); /// put it back on..
@@ -144,7 +145,17 @@ class Pman_Core_Notify extends Pman
                 continue;
             }
             if ($this->poolHasDomain($p->person_id_email)) {
+                if (in_array($p->person_id_email, $pushed)) {
+                    // it's been pushed to the end, and nothing has
+                    // been pushed since.
+                    // give up, let the next run sort it out.
+                    break;
+                }
+                
                 $ar[] = $p; // push it on the end..
+                
+                $pushed[] = $p->person_id_email;
+                
                 echo "domain {$p->person_id_email} already on queue, pushing to end.\n";
                 sleep(3);
                 continue;
@@ -152,6 +163,8 @@ class Pman_Core_Notify extends Pman
             
             
             $this->run($p->id,$p->person_id_email);
+            $pushed = array();
+            
         }
         
         // we should have a time limit here...