feat(sites): cross-process site rate limit via PG token bucket
Migration 0041_rate_limit adds rate_limit_bucket. PgTokenBucket (@umt/db) refills and takes tokens under SELECT ... FOR UPDATE on the DB clock and polls with jitter within a wait budget; penalize() carries Retry-After. Site adapters get createSharedSiteRateLimiter (key site:<id>), shared by api / worker / worker:agent, with an in-process serial queue in front and a local fallback when the bucket is unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
57346d438c
commit
61f585a707
12 files changed
+466
-5
No files matched your search
@@ -38,7 +38,14 @@ export {
|
||||
mteamSearchParams,
|
||||
parseMteamResult,
|
||||
} from "./mteam/spider.ts";
|
||||
export { createSiteRateLimiter, type RateLimiterOptions, type SiteRateLimiter } from "./rate-limit.ts";
|
||||
export {
|
||||
createSharedSiteRateLimiter,
|
||||
createSiteRateLimiter,
|
||||
type RateLimiterOptions,
|
||||
type SharedBucketPort,
|
||||
type SharedRateLimiterOptions,
|
||||
type SiteRateLimiter,
|
||||
} from "./rate-limit.ts";
|
||||
export {
|
||||
createSiteAdapter,
|
||||
getSiteAdapter,
|
||||
|
||||
Reference in new issue
Block a user