Skip to content

Commit

Permalink
feat(proxy): optimize SuspendRequestService (#585)
Browse files Browse the repository at this point in the history
Signed-off-by: SSpirits <[email protected]>
  • Loading branch information
ShadowySpirits authored Nov 6, 2023
1 parent 30d0e3e commit 4f1df04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void writeAndComplete(ProxyContext ctx, ReceiveMessageRequest request, Po
} else {
recordRpcLatency(ctx, Code.OK);
}
break;
case POLLING_FULL:
recordRpcLatency(ctx, Code.TOO_MANY_REQUESTS);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,15 @@ public CompletableFuture<Boolean> tryFetchMessages() {
completed.set(true);
return true;
}
inflight.set(false);
return false;
});
})
.exceptionally(ex -> {
LOGGER.error("Error while fetching messages for suspended request.", ex);
future.completeExceptionally(ex);
completed.set(true);
return true;
})
.whenComplete((result, ex) -> inflight.set(false));
}
return CompletableFuture.completedFuture(false);
}
Expand All @@ -171,6 +177,7 @@ public void notifyMessageArrival(String topic, int queueId, String tag) {
suspendRequestCount.decrementAndGet();
}
}));
break;
}
}
}
Expand Down

0 comments on commit 4f1df04

Please sign in to comment.