Skip to content

Commit

Permalink
Add update check timeout and update check skip (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
LordMonoxide committed Feb 1, 2025
1 parent 015116d commit 00c1af2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/java/legend/core/GameEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ private static void loadGfx() {
}

private static void skip() {
if(time == 0) {
synchronized(UPDATER_LOCK) {
UPDATE_CHECK_FINISHED = true;
}
}

time = 0;
fade1 = 0.0f;
fade2 = 0.0f;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/legend/core/Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.asynchttpclient.ListenableFuture;
import org.asynchttpclient.Response;
import org.jetbrains.annotations.NotNull;
Expand All @@ -11,6 +12,7 @@
import org.json.JSONObject;

import java.io.IOException;
import java.time.Duration;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -43,7 +45,7 @@ public void check(final Consumer<Release> onComplete) {
synchronized(this) {
if(this.client == null) {
try {
this.client = asyncHttpClient();
this.client = asyncHttpClient(new DefaultAsyncHttpClientConfig.Builder().setConnectTimeout(Duration.ofSeconds(10)).setReadTimeout(Duration.ofSeconds(10)).build());
} catch(final Throwable r) {
LOGGER.error("Failed to initialize updater");
}
Expand Down

0 comments on commit 00c1af2

Please sign in to comment.