mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 00:47:57 +00:00
fix(convex): raise download rate limit
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user