MCPcopy
hub / github.com/triggerdotdev/trigger.dev / limit

Method limit

apps/webapp/app/services/rateLimiter.server.ts:47–71  ·  view source on GitHub ↗
(identifier: string, rate = 1)

Source from the content-addressed store, hash-verified

45 }
46
47 async limit(identifier: string, rate = 1): Promise<RateLimitResponse> {
48 const result = this.#ratelimit.limit(identifier, { rate });
49 const { success, limit, reset, remaining } = await result;
50
51 if (success && this.options.logSuccess) {
52 logger.info(`RateLimiter (${this.options.keyPrefix}): under rate limit`, {
53 limit,
54 reset,
55 remaining,
56 identifier,
57 });
58 }
59
60 //log these by default
61 if (!success && this.options.logFailure !== false) {
62 logger.info(`RateLimiter (${this.options.keyPrefix}): rate limit exceeded`, {
63 limit,
64 reset,
65 remaining,
66 identifier,
67 });
68 }
69
70 return result;
71 }
72}
73
74export function createRedisRateLimitClient(

Callers 3

applyRateLimitFunction · 0.45
callMethod · 0.45

Calls 1

infoMethod · 0.65

Tested by

no test coverage detected