-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add retry mechanism and configurable interval for update checks #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Unit Test Results10 tests 10 ✅ 1s ⏱️ Results for commit 5463e2e. ♻️ This comment has been updated with latest results. |
src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java
Outdated
Show resolved
Hide resolved
theEvilReaper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small thing from my side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds retry logic and configurable interval for the update check service. The changes introduce a retry mechanism that stops checking for updates after a maximum number of failed attempts and makes the update check interval configurable via system properties.
- Adds configurable update check interval via system property
ARCR_UPDATE_SERVICE_SCHEDULE - Implements retry count mechanism with configurable max retries via system property
ARCR_UPDATE_SERVICE_MAX_RETRY - Adds HTTP status code validation to detect and count failed update checks
Comments suppressed due to low confidence (1)
src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java:106
- When an IOException or InterruptedException occurs, the retry count is not incremented, but it is incremented for non-200 status codes. This inconsistency means network failures (exceptions) don't count toward the max retry limit, while HTTP errors do. Consider incrementing
retryCount++in the catch block to ensure all failures are counted consistently.
} catch (IOException | InterruptedException e) {
LOGGER.error("Something went wrong to check updates", e);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java
Outdated
Show resolved
Hide resolved
| private final SchedulerService schedulerService; | ||
| private Version remoteVersion; | ||
| private ScheduledTask scheduler; | ||
| private int retryCount = 0; |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retryCount field is accessed from the asynchronous scheduled task without synchronization. Multiple scheduled tasks could potentially execute concurrently, leading to race conditions when reading and incrementing retryCount. Consider using AtomicInteger instead of int for thread-safe operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the alternative for it ?
src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java
Show resolved
Hide resolved
|
@TheMeinerLP check the copilot feedback please |
# [2.8.0](v2.7.2...v2.8.0) (2025-11-22) ### Features * add retry mechanism and configurable interval for update checks ([#201](#201)) ([12c104f](12c104f))
|
🎉 This PR is included in version 2.8.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Proposed changes
We added a status code check and also a retry config to improve stability.
Fixes #196
Types of changes
What types of changes does your code introduce to this project?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any ofthem, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you
did and what alternatives you considered, etc...