Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/limiter/base_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (this *BaseRateLimiter) GetResponseDescriptorStatus(key string, limitInfo *
// The nearLimitThreshold is the number of requests that can be made before hitting the nearLimitRatio.
// We need to know it in both the OK and OVER_LIMIT scenarios.
limitInfo.nearLimitThreshold = uint64(math.Floor(float64(float32(limitInfo.overLimitThreshold) * this.nearLimitRatio)))
logger.Debugf("cache key: %s current: %d", key, limitInfo.limitAfterIncrease)
logger.Debugf("cache key: %s current: %d limit: %d", key, limitInfo.limitAfterIncrease, limitInfo.overLimitThreshold)
if limitInfo.limitAfterIncrease > limitInfo.overLimitThreshold {
isOverLimit = true
responseDescriptorStatus = this.generateResponseDescriptorStatus(pb.RateLimitResponse_OVER_LIMIT,
Expand Down
4 changes: 3 additions & 1 deletion src/service/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ func (this *service) constructLimitsToCheck(request *pb.RateLimitRequest, ctx co
logger.Debugf("descriptor is unlimited, not passing to the cache")
} else {
logger.Debugf(
"applying limit: %d requests per %s, shadow_mode: %t",
"applying limit: %d requests per %s, shadow_mode: %t, quota: %t",
limitsToCheck[i].Limit.RequestsPerUnit,
limitsToCheck[i].Limit.Unit.String(),
limitsToCheck[i].ShadowMode,
limitsToCheck[i].QuotaMode,
)
}
}
Expand Down Expand Up @@ -195,6 +196,7 @@ func (this *service) shouldRateLimitWorker(
assert.Assert(len(limitsToCheck) == len(request.Descriptors))

responseDescriptorStatuses := this.cache.DoLimit(ctx, request, limitsToCheck)
logger.Debugf("descriptor statuses: %+v", responseDescriptorStatuses)
assert.Assert(len(limitsToCheck) == len(responseDescriptorStatuses))

response := &pb.RateLimitResponse{}
Expand Down
Loading