Skip to content

Commit 6955464

Browse files
authored
Run update check using Bukkit scheduler (#4839)
Fixes #4825.
1 parent 997fb18 commit 6955464

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Essentials/src/main/java/com/earth2me/essentials/updatecheck/UpdateChecker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public CompletableFuture<RemoteVersion> fetchLatestDev() {
7676
return pendingDevFuture;
7777
}
7878
pendingDevFuture = new CompletableFuture<>();
79-
new Thread(() -> {
79+
ess.runTaskAsynchronously(() -> {
8080
pendingDevFuture.complete(cachedDev = fetchDistance(BRANCH, getVersionIdentifier()));
8181
pendingDevFuture = null;
8282
lastFetchTime = System.currentTimeMillis();
83-
}).start();
83+
});
8484
return pendingDevFuture;
8585
}
8686
return CompletableFuture.completedFuture(cachedDev);
@@ -92,7 +92,7 @@ public CompletableFuture<RemoteVersion> fetchLatestRelease() {
9292
return pendingReleaseFuture;
9393
}
9494
pendingReleaseFuture = new CompletableFuture<>();
95-
new Thread(() -> {
95+
ess.runTaskAsynchronously(() -> {
9696
catchBlock:
9797
try {
9898
final HttpURLConnection connection = tryRequestWithFallback(LATEST_RELEASE_URL, LATEST_RELEASE_PROXY_URL);
@@ -120,7 +120,7 @@ public CompletableFuture<RemoteVersion> fetchLatestRelease() {
120120
}
121121
pendingReleaseFuture = null;
122122
lastFetchTime = System.currentTimeMillis();
123-
}).start();
123+
});
124124
return pendingReleaseFuture;
125125
}
126126
return CompletableFuture.completedFuture(cachedRelease);

0 commit comments

Comments
 (0)