File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
xds/src/main/java/io/grpc/xds/internal/rlqs Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ public RlqsEngine(
56
56
public RlqsRateLimitResult rateLimit (HttpMatchInput input ) {
57
57
RlqsBucketSettings bucketSettings = bucketMatchers .match (input );
58
58
RlqsBucketId bucketId = bucketSettings .toBucketId (input );
59
+ // Special case when bucket id builder not set.
60
+ if (bucketId == null ) {
61
+ return rateLimitWithoutReports (bucketSettings );
62
+ }
59
63
RlqsBucket bucket = bucketCache .getOrCreate (bucketId , bucketSettings , newBucket -> {
60
64
// Called if a new bucket was created.
61
65
scheduleImmediateReport (newBucket );
@@ -64,6 +68,13 @@ public RlqsRateLimitResult rateLimit(HttpMatchInput input) {
64
68
return bucket .rateLimit ();
65
69
}
66
70
71
+ private static RlqsRateLimitResult rateLimitWithoutReports (RlqsBucketSettings bucketSettings ) {
72
+ if (bucketSettings .noAssignmentStrategy ().rateLimit ()) {
73
+ return RlqsRateLimitResult .deny (bucketSettings .denyResponse ());
74
+ }
75
+ return RlqsRateLimitResult .allow ();
76
+ }
77
+
67
78
private void onBucketsUpdate (List <RlqsUpdateBucketAction > bucketActions ) {
68
79
// TODO(sergiitk): [impl] ensure no more than 1 update at a time.
69
80
for (RlqsUpdateBucketAction bucketAction : bucketActions ) {
You can’t perform that action at this time.
0 commit comments