fix: bypass rate limiter when E2E=true

E2E suite drives registrations from one IP at parallel volume;
production limits trip and flake tests. Same opt-out pattern as the
fail-loud secret/DB-URL guards.
This commit is contained in:
Ullrich Schäfer 2026-05-24 11:57:01 +02:00
parent 6afd996e19
commit 5fef45fb68
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -52,6 +52,12 @@ export interface RateLimitOptions {
* one endpoint doesn't lock out the others.
*/
export function consumeRateLimit(opts: RateLimitOptions): RateLimitResult {
// E2E suite drives auth flows from one IP at high volume; production
// limits would trip and flake tests. Same opt-out pattern as
// requireSecret() / getDatabaseUrl().
if (process.env.E2E === "true") {
return { allowed: true, remaining: opts.limit, resetMs: opts.windowMs };
}
ensureSweeper();
const now = Date.now();
const id = `${opts.scope}:${opts.key}`;