Skip to content

Commit

Permalink
only retain state for per host channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Laub committed Nov 8, 2024
1 parent bed8cd1 commit 1495e17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ static LimitedChannel createForHost(Config cf, Channel channel, int uriIndex, St
* Creates a concurrency limited channel for per-endpoint limiting.
* Metrics are not reported by this component per-endpoint, only by the per-endpoint queue.
*/
static LimitedChannel createForEndpoint(
Channel channel, String channelName, int uriIndex, Endpoint endpoint, StateHolder stateHolder) {
ConcurrencyLimitedChannelState state = stateHolder.getState(STATE_HOLDER_KEY);
static LimitedChannel createForEndpoint(Channel channel, String channelName, int uriIndex, Endpoint endpoint) {
return new ConcurrencyLimitedChannel(
channel,
state.endpointLimiter(),
new CautiousIncreaseAggressiveDecreaseConcurrencyLimiter(Behavior.ENDPOINT_LEVEL),
new EndpointConcurrencyLimitedChannelInstrumentation(channelName, uriIndex, endpoint));
}

Expand All @@ -82,7 +80,6 @@ static LimitedChannel createForEndpoint(
static ConcurrencyLimitedChannelState createState() {
return ImmutableConcurrencyLimitedChannelState.builder()
.hostLimiter(new CautiousIncreaseAggressiveDecreaseConcurrencyLimiter(Behavior.HOST_LEVEL))
.endpointLimiter(new CautiousIncreaseAggressiveDecreaseConcurrencyLimiter(Behavior.ENDPOINT_LEVEL))
.build();
}

Expand Down Expand Up @@ -193,7 +190,5 @@ public String channelNameForLogging() {
@Value.Immutable
interface ConcurrencyLimitedChannelState {
CautiousIncreaseAggressiveDecreaseConcurrencyLimiter hostLimiter();

CautiousIncreaseAggressiveDecreaseConcurrencyLimiter endpointLimiter();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private static ImmutableList<LimitedChannel> createHostChannels(
return unlimited;
}
LimitedChannel limited = ConcurrencyLimitedChannel.createForEndpoint(
unlimited, cf.channelName(), uriIndexForInstrumentation, endpoint, stateHolder);
unlimited, cf.channelName(), uriIndexForInstrumentation, endpoint);
return QueuedChannel.create(cf, endpoint, limited);
});
limitedChannel = ConcurrencyLimitedChannel.createForHost(
Expand Down

0 comments on commit 1495e17

Please sign in to comment.