|
18 | 18 | package com.tencent.polaris.ratelimit.client.flow; |
19 | 19 |
|
20 | 20 | import com.tencent.polaris.api.config.consumer.LoadBalanceConfig; |
| 21 | +import com.tencent.polaris.api.config.consumer.ServiceRouterConfig; |
21 | 22 | import com.tencent.polaris.api.config.provider.RateLimitConfig; |
22 | 23 | import com.tencent.polaris.api.plugin.compose.Extensions; |
23 | 24 | import com.tencent.polaris.api.plugin.ratelimiter.InitCriteria; |
|
41 | 42 | import com.tencent.polaris.specification.api.v1.traffic.manage.RateLimitProto.Rule; |
42 | 43 | import org.slf4j.Logger; |
43 | 44 |
|
| 45 | +import java.util.ArrayList; |
44 | 46 | import java.util.List; |
45 | 47 | import java.util.Objects; |
46 | 48 | import java.util.Random; |
@@ -146,16 +148,18 @@ public RateLimitWindow(RateLimitWindowSet windowSet, CommonQuotaRequest quotaReq |
146 | 148 | this.syncParam = quotaRequest.getFlowControlParam(); |
147 | 149 | remoteCluster = getLimiterClusterService(rule.getCluster(), rateLimitConfig); |
148 | 150 | serviceAddressRepository = buildServiceAddressRepository(rateLimitConfig.getLimiterAddresses(), |
149 | | - uniqueKey, windowSet.getExtensions(), remoteCluster, null, LoadBalanceConfig.LOAD_BALANCE_RING_HASH, "grpc"); |
| 151 | + uniqueKey, windowSet.getExtensions(), remoteCluster); |
150 | 152 | allocatingBucket = getQuotaBucket(initCriteria, windowSet.getRateLimitExtension()); |
151 | 153 | lastAccessTimeMs.set(System.currentTimeMillis()); |
152 | 154 | this.rateLimitConfig = rateLimitConfig; |
153 | 155 | buildRemoteConfigMode(); |
154 | 156 | } |
155 | 157 |
|
156 | 158 | private ServiceAddressRepository buildServiceAddressRepository(List<String> addresses, String hash, Extensions extensions, |
157 | | - ServiceKey remoteCluster, List<String> routers, String lbPolicy, String protocol) { |
158 | | - return new ServiceAddressRepository(addresses, hash, extensions, remoteCluster, routers, lbPolicy, protocol); |
| 159 | + ServiceKey remoteCluster) { |
| 160 | + List<String> routers = new ArrayList<>(); |
| 161 | + routers.add(ServiceRouterConfig.DEFAULT_ROUTER_METADATA); |
| 162 | + return new ServiceAddressRepository(addresses, hash, extensions, remoteCluster, routers, LoadBalanceConfig.LOAD_BALANCE_RING_HASH, "grpc"); |
159 | 163 | } |
160 | 164 |
|
161 | 165 |
|
|
0 commit comments