You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/06/29 07:22:10 UTC

[incubator-shenyu] branch master updated: [ISSUE #3629 ] fix register-client-http: modify loop error. (#3630)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new b6e17d82b [ISSUE #3629 ] fix register-client-http: modify loop error. (#3630)
b6e17d82b is described below

commit b6e17d82bcdd6a97768e233c5b5eb5f3a23803aa
Author: Ethan <et...@gmail.com>
AuthorDate: Wed Jun 29 15:22:04 2022 +0800

    [ISSUE #3629 ] fix register-client-http: modify loop error. (#3630)
    
    * fix register-client-http: modify loop error.
    
    * fix register-client-http: modify loop error.
    
    Co-authored-by: ηŽ‹δΈšη‡Š <wa...@jjl.cn>
---
 .../shenyu/register/client/http/HttpClientRegisterRepository.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java b/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java
index 546061fcd..a7fa59fab 100644
--- a/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java
+++ b/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/HttpClientRegisterRepository.java
@@ -116,7 +116,9 @@ public class HttpClientRegisterRepository extends FailbackRegistryRepository {
     }
     
     private <T> void doRegister(final T t, final String path, final String type) {
+        int i = 0;
         for (String server : serverList) {
+            i++;
             String concat = server.concat(path);
             try {
                 if (StringUtils.isBlank(accessToken)) {
@@ -129,7 +131,9 @@ public class HttpClientRegisterRepository extends FailbackRegistryRepository {
                 return;
             } catch (Exception e) {
                 LOGGER.error("Register admin url :{} is fail, will retry. cause:{}", server, e.getMessage());
-                throw new RuntimeException(e);
+                if (i == serverList.size()) {
+                    throw new RuntimeException(e);
+                }
             }
         }
     }