Skip to content

Commit fb155d1

Browse files
committed
fix:修复pickAddress
1 parent 76eb2f6 commit fb155d1

File tree

2 files changed

+6
-6
lines changed
  • polaris-sync-commons/src/main/java/cn/polarismesh/polaris/sync/common/rest
  • polaris-sync-registry-core/src/main/java/cn/polarismesh/polaris/sync/registry/tasks

2 files changed

+6
-6
lines changed

polaris-sync-commons/src/main/java/cn/polarismesh/polaris/sync/common/rest/RestOperator.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public static String pickAddress(List<String> addresses) {
4848
return addresses.get(0);
4949
}
5050
int i = ThreadLocalRandom.current().nextInt(addresses.size());
51-
if (i >= addresses.size()) {
52-
i = 0;
53-
}
5451
return addresses.get(i);
5552
}
5653

polaris-sync-registry-core/src/main/java/cn/polarismesh/polaris/sync/registry/tasks/PullTask.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.tencent.polaris.client.pb.ResponseProto.DiscoverResponse;
2828
import com.tencent.polaris.client.pb.ServiceProto.Instance;
2929
import java.io.ByteArrayInputStream;
30+
import java.io.PrintWriter;
31+
import java.io.StringWriter;
3032
import java.util.Collection;
3133
import java.util.HashMap;
3234
import java.util.List;
@@ -87,9 +89,10 @@ public void run() {
8789
}
8890
}
8991
} catch (Throwable e) {
90-
ByteArrayInputStream in = new ByteArrayInputStream()
91-
e.printStackTrace();
92-
LOG.error("[Core] pull task(source {}) encounter exception {}", source.getName(), e);
92+
StringWriter sw = new StringWriter();
93+
PrintWriter pw = new PrintWriter(sw);
94+
e.printStackTrace(pw);
95+
LOG.error("[Core] pull task(source {}) encounter exception {}", source.getName(), sw);
9396
}
9497
}
9598

0 commit comments

Comments
 (0)