AUmento de la espera interna-Antigravity
Browse files- 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 |
-
#
|
| 70 |
-
telebot.apihelper.CONNECT_TIMEOUT =
|
| 71 |
-
telebot.apihelper.READ_TIMEOUT =
|
| 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 |
-
#
|
| 151 |
-
|
|
|
|
| 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)
|