From 92ffca5a7a79693620dc60834a321ae4f75863c8 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 10 Dec 2024 10:30:04 +0100 Subject: [PATCH] rate limit notifications push-message-cleanup to once per hour as they lock the notifications table and block each other --- notifications/inc/class.notifications_push.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/notifications/inc/class.notifications_push.inc.php b/notifications/inc/class.notifications_push.inc.php index 0004b1ee8e..98c936bd03 100644 --- a/notifications/inc/class.notifications_push.inc.php +++ b/notifications/inc/class.notifications_push.inc.php @@ -121,6 +121,14 @@ class notifications_push implements Json\PushBackend */ protected static function cleanup_push_msgs() { + // rate limit the deletes: max. once per hour for the instance + $stamp = date('YmdH'); + if (Api\Cache::getInstance(__CLASS__, __FUNCTION__) === $stamp) + { + return; + } + Api\Cache::setInstance(__CLASS__, __FUNCTION__, $stamp); + if (($ts = self::$db->from_unixtime(Api\Session::heartbeat_limit()))) { try {