Skip to content

Conversation

@TheMeinerLP
Copy link
Contributor

@TheMeinerLP TheMeinerLP commented Nov 3, 2025

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 x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, 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.

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

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...

@TheMeinerLP TheMeinerLP requested a review from a team as a code owner November 3, 2025 08:47
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Unit Test Results

10 tests   10 ✅  1s ⏱️
 3 suites   0 💤
 3 files     0 ❌

Results for commit 5463e2e.

♻️ This comment has been updated with latest results.

@TheMeinerLP TheMeinerLP requested a review from Copilot November 4, 2025 19:57
Copy link
Contributor

@theEvilReaper theEvilReaper left a 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

Copy link

Copilot AI left a 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.

private final SchedulerService schedulerService;
private Version remoteVersion;
private ScheduledTask scheduler;
private int retryCount = 0;
Copy link

Copilot AI Nov 4, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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 ?

@OneLiteFeather
Copy link
Contributor

@TheMeinerLP check the copilot feedback please

@TheMeinerLP TheMeinerLP merged commit 12c104f into main Nov 22, 2025
9 checks passed
github-actions bot pushed a commit that referenced this pull request Nov 22, 2025
# [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))
@github-actions
Copy link

🎉 This PR is included in version 2.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TheMeinerLP TheMeinerLP deleted the bugfix/fetching-of-remote-version branch November 27, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async UpdateService exception: UnexpectedCharacterException when parsing version

4 participants