mattisonchao opened a new pull request #14259:
URL: https://github.com/apache/pulsar/pull/14259


   ### Motivation
   
   Currently, some RestAPI will print an error log when the server returns the 
redirect code(307). which can let the user a lit bit confusing.
   
   ### Modifications
   
   - Check if "RestException" is a redirect code.
   - Clean up some unused methods.
   - **Add some missing ``exceptionally``handlers that will make the request 
timeout.** 
    > like code lines 3048 - 3427
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
   
   - [x] `no-need-doc` 
     
   ### Q&A
   
   Q: Why remove code as follow:
   
   ```java
    if (cause instanceof WebApplicationException
                               && ((WebApplicationException) 
cause).getResponse().getStatus()
                               == Status.TEMPORARY_REDIRECT.getStatusCode()) {
                               if (log.isDebugEnabled()) {
                                   log.debug("[{}] Failed to get subscriptions 
for non-partitioned topic {},"
                                                   + " redirecting to other 
brokers.", clientAppId(), topicName, cause);
                               }
                       }
   ```
   A: because some methods like ``validateTopicOwnershipAsync `` already have 
logged.
   
   
https://github.com/apache/pulsar/blob/ed563447f5fb8b34917ae343aebfc6a704515ed9/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java#L662-L674
   
   ### Additional
   
   We have some code like this:
   
   
![image](https://user-images.githubusercontent.com/74767115/153738470-ced6dce2-d973-4c03-b162-db71802f9e8f.png)
   
   Multiple exception handlers will cause some code complexity, I think we can 
merge those handlers in another PR.
   
   
   


-- 
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]


Reply via email to