From 6b7d7e76e976c0973033900fa1ed9d39b87da685 Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 9 Aug 2023 15:43:41 +0800 Subject: [PATCH] slightly better logging... and distribute requeue --- Notify.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Notify.php b/Notify.php index 9dbca025..35843324 100644 --- a/Notify.php +++ b/Notify.php @@ -273,9 +273,11 @@ class Pman_Core_Notify extends Pman if ($pushed === false) { // we only try once to requeue.. + $this->logecho("REQUEING email for next run, as we have maxed out that domain"); $requeue[] = $p; continue; } + $this->logecho("PUSHING email, as we have maxed out that domain"); $pushed[] = $p; @@ -299,6 +301,7 @@ class Pman_Core_Notify extends Pman foreach($requeue as $p) { $pp = clone($p); $p->act_when = $p->sqlValue('NOW + INTERVAL 1 MINUTE'); + $this->updateServer($p); $p->update($pp); } @@ -308,7 +311,19 @@ class Pman_Core_Notify extends Pman exit; } - + // this sequentially distributes requeued emails.. - to other servers. + function updateServer($w) + { + $ff = HTML_FlexyFramework::get(); + static $num = 0; + if (empty($ff->Core_Notify['servers'])) { + return; + } + $num++; + // next server.. + $w->server_id = $num % count(array_keys($ff->Core_Notify['servers'])); + + } function generateNotifications() -- 2.39.2