fix(convex): raise download rate limit

This commit is contained in:
Vincent Koc
2026-05-03 00:24:42 -07:00
parent 05653453ea
commit 6085ee4852
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -1,6 +1,6 @@
/* @vitest-environment node */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { applyRateLimit, getClientIp } from "./httpRateLimit";
import { applyRateLimit, getClientIp, RATE_LIMITS } from "./httpRateLimit";
type MockRateLimitStatus = {
allowed: boolean;
@@ -111,6 +111,13 @@ describe("getClientIp", () => {
});
});
describe("RATE_LIMITS", () => {
it("keeps anonymous download bursts installation-friendly", () => {
expect(RATE_LIMITS.download.ip).toBeGreaterThanOrEqual(180);
expect(RATE_LIMITS.download.key).toBeGreaterThanOrEqual(720);
});
});
describe("applyRateLimit headers", () => {
afterEach(() => {
vi.restoreAllMocks();
+1 -1
View File
@@ -8,7 +8,7 @@ const RATE_LIMIT_SHARDS = 64;
export const RATE_LIMITS = {
read: { ip: 600, key: 2400 },
write: { ip: 45, key: 180 },
download: { ip: 30, key: 180 },
download: { ip: 180, key: 720 },
} as const;
type RateLimitResult = {