MCPcopy
hub / github.com/scality/cloudserver / buildRateChecksFromConfig

Function buildRateChecksFromConfig

lib/api/apiUtils/rateLimit/helpers.js:145–161  ·  view source on GitHub ↗
(resourceClass, resourceId, limitConfig)

Source from the content-addressed store, hash-verified

143}
144
145function buildRateChecksFromConfig(resourceClass, resourceId, limitConfig) {
146 const checks = [];
147 if (limitConfig?.RequestsPerSecond?.Limit > 0) {
148 checks.push({
149 resourceClass,
150 resourceId,
151 measure: 'rps',
152 source: limitConfig.RequestsPerSecond.source,
153 config: {
154 limit: limitConfig.RequestsPerSecond.Limit,
155 burstCapacity: limitConfig.RequestsPerSecond.BurstCapacity * 1000,
156 },
157 });
158 }
159
160 return checks;
161}
162
163function checkRateLimitsForRequest(checks, log) {
164 const buckets = [];

Callers 2

checkRateLimitIfNeededFunction · 0.85
callApiMethodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected