rate limit notifications push-message-cleanup to once per hour as they lock the notifications table and block each other

This commit is contained in:
ralf 2024-12-10 10:30:04 +01:00
parent 2356c6e0dd
commit 92ffca5a7a

View File

@ -121,6 +121,14 @@ class notifications_push implements Json\PushBackend
*/ */
protected static function cleanup_push_msgs() 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()))) if (($ts = self::$db->from_unixtime(Api\Session::heartbeat_limit())))
{ {
try { try {