Skip to content

Commit 368bfdb

Browse files
authored
[fix](cloud) fix incorrect timeout of FE connection pool (#41202)
1 parent e409ebe commit 368bfdb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.io.InputStreamReader;
3434
import java.nio.charset.StandardCharsets;
3535
import java.util.Map;
36+
import java.util.Random;
3637
import java.util.concurrent.Future;
3738
import java.util.concurrent.TimeUnit;
3839

@@ -45,6 +46,7 @@ public class MetaServiceClient {
4546
private final ManagedChannel channel;
4647
private final long expiredAt;
4748
private final boolean isMetaServiceEndpointList;
49+
private Random random = new Random();
4850

4951
static {
5052
NameResolverRegistry.getDefaultRegistry().register(new MetaServiceListResolverProvider());
@@ -76,7 +78,9 @@ private long connectionAgeExpiredAt() {
7678
// Disable connection age if the endpoint is a list.
7779
if (!isMetaServiceEndpointList && connectionAgeBase > 1) {
7880
long base = TimeUnit.MINUTES.toMillis(connectionAgeBase);
79-
return base + System.currentTimeMillis() % base;
81+
long now = System.currentTimeMillis();
82+
long rand = random.nextLong(base);
83+
return now + base + rand;
8084
}
8185
return Long.MAX_VALUE;
8286
}

0 commit comments

Comments
 (0)