From ca4252c9cbf9d86a60b17bf11e49a7b72032bd7c Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 17 Jan 2026 06:40:12 +0300 Subject: [PATCH] Update admin_users.py --- app/cabinet/routes/admin_users.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/cabinet/routes/admin_users.py b/app/cabinet/routes/admin_users.py index 4004adde..93ffbb39 100644 --- a/app/cabinet/routes/admin_users.py +++ b/app/cabinet/routes/admin_users.py @@ -1220,9 +1220,14 @@ async def get_user_sync_status( from datetime import timezone panel_end_utc = panel_expire_at.astimezone(timezone.utc).replace(tzinfo=None) else: + # Panel might return naive datetime in MSK (UTC+3), try both interpretations panel_end_utc = panel_expire_at + diff_seconds = abs((bot_end_utc - panel_end_utc).total_seconds()) - if diff_seconds > 3600: # More than 1 hour difference + # Allow for timezone offset (3 hours = MSK) and small sync delays + # If diff is ~3 hours (10800 sec) +/- 5 min, assume it's timezone issue + is_timezone_diff = abs(diff_seconds - 10800) < 300 # 3 hours +/- 5 min + if diff_seconds > 3600 and not is_timezone_diff: # More than 1 hour and not timezone differences.append(f"End date differs by {diff_seconds/3600:.1f} hours") if abs(bot_traffic_limit - panel_traffic_limit) > 1: