From: Alan Knowles Date: Fri, 3 Feb 2012 02:40:27 +0000 (+0800) Subject: Notify.php X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=7d7d9edd6a21d4a08261dcfb0e8e38e7ef2003b3;p=Pman.Core Notify.php --- diff --git a/Notify.php b/Notify.php index 41d65206..3d5673f8 100644 --- a/Notify.php +++ b/Notify.php @@ -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...