From 5bc033cf40e701591669e600253d68f67ccb660d Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Fri, 2 Jul 2021 20:30:03 -0300 Subject: [PATCH] make protocol version cache expire faster --- README.md | 2 +- .../viaversion/fabric/mc114/service/ProtocolAutoDetector.java | 2 +- .../viaversion/fabric/mc115/service/ProtocolAutoDetector.java | 2 +- .../viaversion/fabric/mc116/service/ProtocolAutoDetector.java | 2 +- .../viaversion/fabric/mc117/service/ProtocolAutoDetector.java | 2 +- .../viaversion/fabric/mc18/service/ProtocolAutoDetector.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 755adea..120f96a 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ or registry synchronization (fabric-registry-sync mod). similar in the server it may use the translated version, differently than multiconnect which uses -1 version, which may get the native server version. - It may hold your handshake for up to 10 seconds. -- The auto-detected version is cached for 100 seconds. +- The auto-detected version is cached for 30 seconds. ### How can I set the version for specific servers?: diff --git a/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/service/ProtocolAutoDetector.java b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/service/ProtocolAutoDetector.java index 65785bc..930225a 100644 --- a/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/service/ProtocolAutoDetector.java +++ b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/service/ProtocolAutoDetector.java @@ -33,7 +33,7 @@ import java.util.logging.Level; @Environment(EnvType.CLIENT) public class ProtocolAutoDetector { private static LoadingCache> SERVER_VER = CacheBuilder.newBuilder() - .expireAfterAccess(100, TimeUnit.SECONDS) + .expireAfterWrite(30, TimeUnit.SECONDS) .build(CacheLoader.from((address) -> { CompletableFuture future = new CompletableFuture<>(); diff --git a/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/service/ProtocolAutoDetector.java b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/service/ProtocolAutoDetector.java index 75cc50e..3656cbb 100644 --- a/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/service/ProtocolAutoDetector.java +++ b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/service/ProtocolAutoDetector.java @@ -33,7 +33,7 @@ import java.util.logging.Level; @Environment(EnvType.CLIENT) public class ProtocolAutoDetector { private static LoadingCache> SERVER_VER = CacheBuilder.newBuilder() - .expireAfterAccess(100, TimeUnit.SECONDS) + .expireAfterWrite(30, TimeUnit.SECONDS) .build(CacheLoader.from((address) -> { CompletableFuture future = new CompletableFuture<>(); diff --git a/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/service/ProtocolAutoDetector.java b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/service/ProtocolAutoDetector.java index cf41e28..c6f8a1c 100644 --- a/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/service/ProtocolAutoDetector.java +++ b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/service/ProtocolAutoDetector.java @@ -33,7 +33,7 @@ import java.util.logging.Level; @Environment(EnvType.CLIENT) public class ProtocolAutoDetector { private static LoadingCache> SERVER_VER = CacheBuilder.newBuilder() - .expireAfterAccess(100, TimeUnit.SECONDS) + .expireAfterWrite(30, TimeUnit.SECONDS) .build(CacheLoader.from((address) -> { CompletableFuture future = new CompletableFuture<>(); diff --git a/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/service/ProtocolAutoDetector.java b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/service/ProtocolAutoDetector.java index cdef15b..b5a2068 100644 --- a/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/service/ProtocolAutoDetector.java +++ b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/service/ProtocolAutoDetector.java @@ -33,7 +33,7 @@ import java.util.logging.Level; @Environment(EnvType.CLIENT) public class ProtocolAutoDetector { private static LoadingCache> SERVER_VER = CacheBuilder.newBuilder() - .expireAfterAccess(100, TimeUnit.SECONDS) + .expireAfterWrite(30, TimeUnit.SECONDS) .build(CacheLoader.from((address) -> { CompletableFuture future = new CompletableFuture<>(); diff --git a/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/service/ProtocolAutoDetector.java b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/service/ProtocolAutoDetector.java index cb3d6c3..bd59cee 100644 --- a/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/service/ProtocolAutoDetector.java +++ b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/service/ProtocolAutoDetector.java @@ -33,7 +33,7 @@ import java.util.logging.Level; @Environment(EnvType.CLIENT) public class ProtocolAutoDetector { private static LoadingCache> SERVER_VER = CacheBuilder.newBuilder() - .expireAfterAccess(100, TimeUnit.SECONDS) + .expireAfterWrite(30, TimeUnit.SECONDS) .build(CacheLoader.from((address) -> { CompletableFuture future = new CompletableFuture<>();