Commit 368bfdb 1 parent e409ebe commit 368bfdb Copy full SHA for 368bfdb
File tree 1 file changed +5
-1
lines changed
fe/fe-core/src/main/java/org/apache/doris/cloud/rpc
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 33
33
import java .io .InputStreamReader ;
34
34
import java .nio .charset .StandardCharsets ;
35
35
import java .util .Map ;
36
+ import java .util .Random ;
36
37
import java .util .concurrent .Future ;
37
38
import java .util .concurrent .TimeUnit ;
38
39
@@ -45,6 +46,7 @@ public class MetaServiceClient {
45
46
private final ManagedChannel channel ;
46
47
private final long expiredAt ;
47
48
private final boolean isMetaServiceEndpointList ;
49
+ private Random random = new Random ();
48
50
49
51
static {
50
52
NameResolverRegistry .getDefaultRegistry ().register (new MetaServiceListResolverProvider ());
@@ -76,7 +78,9 @@ private long connectionAgeExpiredAt() {
76
78
// Disable connection age if the endpoint is a list.
77
79
if (!isMetaServiceEndpointList && connectionAgeBase > 1 ) {
78
80
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 ;
80
84
}
81
85
return Long .MAX_VALUE ;
82
86
}
You can’t perform that action at this time.
0 commit comments