Skip to content

Conversation

rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Aug 29, 2025

This is a prototype; we don't want to apply it automatically. Intent for now is to see if this helps avoid connection errors during the regression piplines in Jenkins.

@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 18:16
Copy link

@Copilot 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 introduces a prototype retry interceptor for the MarkLogic client API to handle connection errors during regression pipeline testing in Jenkins. The implementation adds automatic retry functionality with exponential backoff for certain types of network failures.

  • Adds a new RetryInterceptor class that implements OkHttp's Interceptor interface
  • Integrates the retry interceptor into the client builder with default retry parameters
  • Implements exponential backoff with configurable retry attempts and delay bounds

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
RetryInterceptor.java New interceptor class implementing retry logic with exponential backoff for connection failures
OkHttpUtil.java Integrates the retry interceptor into the OkHttp client builder configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

try {
Thread.sleep(delay);
} catch (InterruptedException ie) {
logger.warn("Ignoring InterruptedException while sleeping for retry delay: {}", ie.getMessage());
Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When InterruptedException is caught, the thread's interrupt status should be restored by calling Thread.currentThread().interrupt() to properly handle thread interruption.

Suggested change
logger.warn("Ignoring InterruptedException while sleeping for retry delay: {}", ie.getMessage());
logger.warn("Interrupted while sleeping for retry delay: {}", ie.getMessage());
Thread.currentThread().interrupt();

Copilot uses AI. Check for mistakes.

}
}

throw lastException;
Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is unreachable because the for loop will always either return a successful response or throw an exception within the loop body. The lastException will never be null when reaching this point.

Suggested change
throw lastException;

Copilot uses AI. Check for mistakes.

This is a prototype; we don't want to apply it automatically. Intent for now is to see if this helps avoid connection errors during the regression piplines in Jenkins.
@rjrudin rjrudin force-pushed the feature/retry-listener branch from 496ad4b to 75819de Compare September 2, 2025 13:46
@rjrudin rjrudin merged commit 77daa2f into develop Sep 2, 2025
2 checks passed
@rjrudin rjrudin deleted the feature/retry-listener branch September 2, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant