Skip to content

Commit 8b66d77

Browse files
committed
fix: reset retry count and safely handle scheduler shutdown on max retries
1 parent fc004dc commit 8b66d77

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public void run() {
4444
if (retryCount >= MAX_RETRY_COUNT) {
4545
LOGGER.error("Max retry count reached for update check, stopping further attempts");
4646
LOGGER.error("Please check your internet connection or https://hangar.papermc.io/ status.");
47-
47+
if (this.scheduler != null) {
48+
this.shutdown();
49+
}
4850
return;
4951
}
5052
var remoteVersion = getNewerVersion();
@@ -98,6 +100,7 @@ private Version getNewerVersion() {
98100
retryCount++;
99101
return null;
100102
}
103+
this.retryCount = 0;
101104
Version remoteVersion = Version.parse(httpResponse.body());
102105
if (remoteVersion.isHigherThan(this.localVersion)) {
103106
return remoteVersion;

0 commit comments

Comments
 (0)