fix: shouldNotify maneja undefined y admite primer aviso por usuario

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

@ -50,7 +50,12 @@ export class RateLimiter {
} }
static shouldNotify(userId: string, now: number = Date.now()): boolean { static shouldNotify(userId: string, now: number = Date.now()): boolean {
const last = this.lastNotifyAt.get(userId) || 0; const last = this.lastNotifyAt.get(userId);
// Si nunca se ha notificado, permitir notificar inmediatamente
if (last === undefined) {
this.lastNotifyAt.set(userId, now);
return true;
}
if (now - last >= this.NOTIFY_COOLDOWN_MS) { if (now - last >= this.NOTIFY_COOLDOWN_MS) {
this.lastNotifyAt.set(userId, now); this.lastNotifyAt.set(userId, now);
return true; return true;

Loading…
Cancel
Save