Skip to content

Commit

Permalink
Merge pull request #191 from nicholashagen/update-inflight-metrics-wh…
Browse files Browse the repository at this point in the history
…en-rejected

Ensure the inflight metrics are properly updated when rejecting
  • Loading branch information
fedorka authored Jan 17, 2024
2 parents 5522e3d + 1c486a9 commit 291d7bb
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ public SimpleLimiter(AbstractLimiter.Builder<?> builder) {

@Override
public Optional<Limiter.Listener> acquire(ContextT context) {
Optional<Limiter.Listener> listener;
if (!semaphore.tryAcquire()) {
return createRejectedListener();
listener = createRejectedListener();
}
Listener listener = new Listener(createListener());
else {
listener = Optional.of(new Listener(createListener()));
}

inflightDistribution.addSample(getInflight());
return Optional.of(listener);
return listener;
}

@Override
Expand Down

0 comments on commit 291d7bb

Please sign in to comment.