Skip to content

Commit 7c8844f

Browse files
authored
chore(utils): Adjust JSDoc of rate limit functions (#6748)
1 parent 90cfe00 commit 7c8844f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/utils/src/ratelimit.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ export function parseRetryAfterHeader(header: string, now: number = Date.now()):
2626
}
2727

2828
/**
29-
* Gets the time that given category is disabled until for rate limiting
29+
* Gets the time that the given category is disabled until for rate limiting.
30+
* In case no category-specific limit is set but a general rate limit across all categories is active,
31+
* that time is returned.
32+
*
33+
* @return the time in ms that the category is disabled until or 0 if there's no active rate limit.
3034
*/
3135
export function disabledUntil(limits: RateLimits, category: string): number {
3236
return limits[category] || limits.all || 0;
@@ -41,7 +45,8 @@ export function isRateLimited(limits: RateLimits, category: string, now: number
4145

4246
/**
4347
* Update ratelimits from incoming headers.
44-
* Returns true if headers contains a non-empty rate limiting header.
48+
*
49+
* @return the updated RateLimits object.
4550
*/
4651
export function updateRateLimits(
4752
limits: RateLimits,

0 commit comments

Comments
 (0)