06-sep: [perf] opencode-tg: poll 1s, fin desde 2s, envio fragmentos 0.1s

This commit is contained in:
juanjo
2026-09-06 20:20:41 +02:00
parent fd3f190534
commit 4562caa585

View File

@@ -122,7 +122,7 @@ def enviar(chat_id, texto, parse="HTML"):
_registrar(chat_id, tg("sendMessage", _registrar(chat_id, tg("sendMessage",
{"chat_id": chat_id, "text": texto[i:i + 3900], {"chat_id": chat_id, "text": texto[i:i + 3900],
"parse_mode": parse})) "parse_mode": parse}))
time.sleep(0.3) time.sleep(0.1)
def enviar_doc(chat_id, ruta, caption=None): def enviar_doc(chat_id, ruta, caption=None):
@@ -424,7 +424,7 @@ def procesar_texto(chat, texto):
comienzo = time.time() comienzo = time.time()
terminado = False terminado = False
while time.time() - comienzo < 900: while time.time() - comienzo < 900:
time.sleep(2) time.sleep(1)
code, hist = oc_get(f"/session/{sid}/message?limit=10") code, hist = oc_get(f"/session/{sid}/message?limit=10")
if code == 200 and isinstance(hist, list): if code == 200 and isinstance(hist, list):
for item in reversed(hist[-10:]): for item in reversed(hist[-10:]):
@@ -444,7 +444,7 @@ def procesar_texto(chat, texto):
transcurrido = time.time() - comienzo transcurrido = time.time() - comienzo
if (code2 == 200 and isinstance(sts, dict) if (code2 == 200 and isinstance(sts, dict)
and sts.get(sid, {}).get("type") != "busy" and sts.get(sid, {}).get("type") != "busy"
and transcurrido >= 5): and transcurrido >= 2):
terminado = True terminado = True
break break