MCPcopy Index your code
hub / github.com/scality/cloudserver / requestNeedsRateCheck

Function requestNeedsRateCheck

lib/api/apiUtils/rateLimit/helpers.js:8–21  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

6const rateLimitApiActions = Object.keys(actionMapBucketRateLimit);
7
8function requestNeedsRateCheck(request) {
9 // Is the feature enabled?
10 if (!config.rateLimiting.enabled) {
11 return false;
12 }
13
14 // Is the request an internal or rate limit admin operation?
15 if (rateLimitApiActions.includes(request.apiMethod) || request.isInternalServiceRequest) {
16 return false;
17 }
18
19 // Have we already checked both bucket and account configs?
20 return !(request.rateLimitAccountAlreadyChecked && request.rateLimitBucketAlreadyChecked);
21}
22
23/**
24 * Extract bucket rate limit configuration from bucket metadata or global rate limit configuration.

Callers 2

checkRateLimitIfNeededFunction · 0.85
callApiMethodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected