mattisonchao commented on code in PR #15656:
URL: https://github.com/apache/pulsar/pull/15656#discussion_r877017584
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -1373,43 +1373,33 @@ protected DispatchRate
internalGetSubscriptionDispatchRate() {
return
policies.subscriptionDispatchRate.get(pulsar().getConfiguration().getClusterName());
}
- protected void internalSetSubscribeRate(SubscribeRate subscribeRate) {
- validateSuperUserAccess();
+ protected CompletableFuture<Void>
internalSetSubscribeRateAsync(SubscribeRate subscribeRate) {
log.info("[{}] Set namespace subscribe-rate {}/{}", clientAppId(),
namespaceName, subscribeRate);
- try {
+ return validateSuperUserAccessAsync().thenAccept(__ -> {
updatePolicies(namespaceName, policies -> {
Review Comment:
This method should be async.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -1373,43 +1373,33 @@ protected DispatchRate
internalGetSubscriptionDispatchRate() {
return
policies.subscriptionDispatchRate.get(pulsar().getConfiguration().getClusterName());
}
- protected void internalSetSubscribeRate(SubscribeRate subscribeRate) {
- validateSuperUserAccess();
+ protected CompletableFuture<Void>
internalSetSubscribeRateAsync(SubscribeRate subscribeRate) {
log.info("[{}] Set namespace subscribe-rate {}/{}", clientAppId(),
namespaceName, subscribeRate);
- try {
+ return validateSuperUserAccessAsync().thenAccept(__ -> {
updatePolicies(namespaceName, policies -> {
policies.clusterSubscribeRate.put(pulsar().getConfiguration().getClusterName(),
subscribeRate);
return policies;
});
log.info("[{}] Successfully updated the subscribeRate for cluster
on namespace {}", clientAppId(),
namespaceName);
- } catch (Exception e) {
- log.error("[{}] Failed to update the subscribeRate for cluster on
namespace {}", clientAppId(),
- namespaceName, e);
- throw new RestException(e);
- }
+ });
}
- protected void internalDeleteSubscribeRate() {
- validateSuperUserAccess();
- try {
+ protected CompletableFuture<Void> internalDeleteSubscribeRateAsync() {
+ return validateSuperUserAccessAsync().thenAccept(__ -> {
updatePolicies(namespaceName, policies -> {
Review Comment:
This method should be async.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]