From 71803174b0da95059c545c82ec3a6da6bfacb895 Mon Sep 17 00:00:00 2001 From: Capybara-z Date: Sun, 25 May 2025 19:47:35 +0300 Subject: [PATCH] Fix key expiration notification and auto-renewal handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Исправлена обработка уведомлений об истечении ключей. - Добавлена корректная работа с задержкой удаления ключей и авто-продлением подписок. --- handlers/notifications/general_notifications.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/notifications/general_notifications.py b/handlers/notifications/general_notifications.py index 17f74a5c..7bcee1f3 100644 --- a/handlers/notifications/general_notifications.py +++ b/handlers/notifications/general_notifications.py @@ -393,7 +393,7 @@ async def handle_expired_keys( tariffs = await get_tariffs_for_cluster(session, server_id) tariff = tariffs[0] if tariffs else None - if tariff and balance >= tariff.price_rub: + if tariff and balance >= tariff["price_rub"]: await process_auto_renew_or_notify( bot, session, @@ -414,10 +414,10 @@ async def handle_expired_keys( if last_notification_time is not None: delete_after_delay = ( - current_time - last_notification_time.timestamp() * 1000 + current_time - last_notification_time ) / (1000 * 60) >= NOTIFY_DELETE_DELAY logger.info( - f"Прошло минут={(current_time - last_notification_time.timestamp() * 1000) / (1000 * 60):.2f} " + f"Прошло минут={(current_time - last_notification_time) / (1000 * 60):.2f} " f"NOTIFY_DELETE_DELAY={NOTIFY_DELETE_DELAY}" )