feat: hacer dinámico el mensaje del límite por minuto y README

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent c1c142c72c
commit bff4c99876

@ -99,9 +99,9 @@ Consulta .env.example para un listado comentado con valores de ejemplo.
- Objetivo: trazabilidad de cambios.
- Implica: tabla task_events; eventos en crear/asignar/tomar/soltar/completar; consulta “historial”.
8) Rate limiting (operación segura)
8) Rate limiting (operación segura) — completado
- Objetivo: proteger ante abuso o loops.
- Implica: token bucket por usuario/grupo; configuración de límites.
- Implementado: token bucket por usuario con límites configurables (RATE_LIMIT_PER_MIN, RATE_LIMIT_BURST) y aviso con cooldown.
9) Sincronización de miembros (opcional)
- Objetivo: conocer miembros activos por grupo para features avanzadas.
@ -114,7 +114,7 @@ Consulta .env.example para un listado comentado con valores de ejemplo.
## 🔑 Key Considerations & Caveats
* **WhatsApp ID Normalization:** Crucial for consistently identifying users and groups. Needs careful implementation to handle edge cases. (Utility function exists).
* **Response Latency:** Sending responses requires an API call back to Evolution. Ensure the `ResponseQueue` processing is efficient.
* **Cola de respuestas:** Persistente en DB; pendiente añadir reintentos/backoff y limpieza/retención.
* **Cola de respuestas:** Persistente en DB; con reintentos (backoff exponencial + jitter), recuperación tras reinicios y limpieza/retención configurables.
* **Group Sync:** The current full sync might be slow or rate-limited with many groups. Delta updates are recommended long-term.
* **Error Handling:** Failures in command processing or response sending should be logged clearly and potentially reported back to the user. Database operations should use transactions for atomicity (especially task+assignment creation).
* **State Management:** The current design is stateless. Complex interactions might require state persistence later.

@ -225,7 +225,7 @@ export class WebhookServer {
if (RateLimiter.shouldNotify(normalizedSenderId)) {
await ResponseQueue.add([{
recipient: normalizedSenderId,
message: 'Has superado el límite de 15 comandos por minuto. Inténtalo de nuevo en un momento.'
message: `Has superado el límite de ${((() => { const v = Number(process.env.RATE_LIMIT_PER_MIN); return Number.isFinite(v) && v > 0 ? v : 15; })())} comandos por minuto. Inténtalo de nuevo en un momento.`
}]);
}
return;

Loading…
Cancel
Save