From 401fa249b9ed4062d220802546f3f6a1ba7cbb7a Mon Sep 17 00:00:00 2001 From: Winzen Date: Thu, 26 Feb 2026 06:51:45 -0300 Subject: [PATCH] Fix disable_unhealthy_flow_schedules and _check_for_updates --- .../_disable_unhealthy_flow_schedules/service.py | 3 ++- .../management/commands/send_notification.py | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/service.py b/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/service.py index 7f3e7210..460027eb 100644 --- a/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/service.py +++ b/backend/apps/core/management/commands/_disable_unhealthy_flow_schedules/service.py @@ -76,7 +76,8 @@ def disable_unhealthy_flow_schedules(self) -> None: if flows_to_disable: for flow in flows_to_disable: - self.set_flow_schedule(flow_id=flow.id, active=False) + for _ in range(2): # Existe um bug onde o Flow não desativa com apenas uma query + self.set_flow_schedule(flow_id=flow.id, active=False) message_parts = [ self.format_flows("🚨 Flows em alerta", flows), diff --git a/backend/apps/user_notifications/management/commands/send_notification.py b/backend/apps/user_notifications/management/commands/send_notification.py index 390de5dc..78488166 100644 --- a/backend/apps/user_notifications/management/commands/send_notification.py +++ b/backend/apps/user_notifications/management/commands/send_notification.py @@ -14,10 +14,13 @@ def check_for_updates(subscription: TableUpdateSubscription) -> TableUpdateSubscription | bool: table = subscription.table - - if subscription.updated_at < table.last_updated_at: - return subscription - return False + try: + if subscription.updated_at < table.last_updated_at: + return subscription + return False + except Exception: + print(f"Tabela: {table.dataset.name}{table.name} está com erro") + return False def send_update_notification_email(user: Account, subscriptions: list, date_today: dj_timezone):