Edoruin commited on
Commit
8a4f554
·
1 Parent(s): d5b2581

AUmento de la espera interna-Antigravity

Browse files
Files changed (1) hide show
  1. app/main.py +6 -5
app/main.py CHANGED
@@ -66,9 +66,9 @@ def main(page: ft.Page):
66
  # Asegurarnos de que el formato sea correcto
67
  base_url = GOOGLE_PROXY_URL.split('?')[0] # Limpiar parámetros previos
68
  telebot.apihelper.API_URL = base_url + "?path={1}&token={0}"
69
- # Aumentar timeouts para Google Apps Script (que a veces es lento)
70
- telebot.apihelper.CONNECT_TIMEOUT = 30
71
- telebot.apihelper.READ_TIMEOUT = 30
72
 
73
  # Inicializar bot
74
  bot = telebot.TeleBot(TG_TOKEN) if TG_TOKEN else None
@@ -147,8 +147,9 @@ def main(page: ft.Page):
147
  if bot:
148
  while True:
149
  try:
150
- # El polling seguirá fallando si api.telegram.org está bloqueado totalmente
151
- bot.infinity_polling(timeout=10, long_polling_timeout=5)
 
152
  except Exception as e:
153
  print(f"Error de red en el bot (DNS/Bloqueo?): {e}. Reintentando en 60s...")
154
  time.sleep(60)
 
66
  # Asegurarnos de que el formato sea correcto
67
  base_url = GOOGLE_PROXY_URL.split('?')[0] # Limpiar parámetros previos
68
  telebot.apihelper.API_URL = base_url + "?path={1}&token={0}"
69
+ # Google es lento; subimos el timeout del socket interno
70
+ telebot.apihelper.CONNECT_TIMEOUT = 60
71
+ telebot.apihelper.READ_TIMEOUT = 60
72
 
73
  # Inicializar bot
74
  bot = telebot.TeleBot(TG_TOKEN) if TG_TOKEN else None
 
147
  if bot:
148
  while True:
149
  try:
150
+ # Bajamos el timeout del 'getUpdates' para que Google no corte la conexión
151
+ # pero mantenemos el 'interval' para darle respiro
152
+ bot.infinity_polling(timeout=20, long_polling_timeout=10)
153
  except Exception as e:
154
  print(f"Error de red en el bot (DNS/Bloqueo?): {e}. Reintentando en 60s...")
155
  time.sleep(60)