From fa65cb48d392ed8fb760c82216d1f1b92cc22aed Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 10 Aug 2023 18:22:29 +0800 Subject: [PATCH] reduce number of update queries --- Notify.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Notify.php b/Notify.php index cff037ac..684b4ead 100644 --- a/Notify.php +++ b/Notify.php @@ -379,6 +379,20 @@ class Pman_Core_Notify extends Pman $num_servers = count(array_keys($ff->Core_Notify['servers'])); $p = DB_DataObject::factory($this->table); + $p->whereAdd(" + sent < '2000-01-01' + and + event_id = 0 + and + act_start < NOW() + INTERVAL 3 HOUR + and + server_id < 0" + + ); + if ($p->count() < 1) { + return; + } + // 6 seconds on this machne... $p->query(" UPDATE @@ -390,13 +404,13 @@ class Pman_Core_Notify extends Pman and event_id = 0 and - act_start < NOW() + act_start < NOW() + INTERVAL 3 HOUR and server_id < 0 ORDER BY id ASC LIMIT - 20000 + 10000 "); -- 2.39.2