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:
parent
6afd996e19
commit
5fef45fb68
1 changed files with 6 additions and 0 deletions
|
|
@ -52,6 +52,12 @@ export interface RateLimitOptions {
|
||||||
* one endpoint doesn't lock out the others.
|
* one endpoint doesn't lock out the others.
|
||||||
*/
|
*/
|
||||||
export function consumeRateLimit(opts: RateLimitOptions): RateLimitResult {
|
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();
|
ensureSweeper();
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const id = `${opts.scope}:${opts.key}`;
|
const id = `${opts.scope}:${opts.key}`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue