Skip to content

Comments

Add retry support#1531

Merged
niveathika merged 10 commits intoballerina-platform:masterfrom
niveathika:retry
Feb 3, 2026
Merged

Add retry support#1531
niveathika merged 10 commits intoballerina-platform:masterfrom
niveathika:retry

Conversation

@niveathika
Copy link
Contributor

@niveathika niveathika commented Feb 1, 2026

Purpose

Fixes ballerina-platform/ballerina-library#8585

Examples

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

❌ Patch coverage is 72.17391% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.38%. Comparing base (9898a6a) to head (ebe3428).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
...java/io/ballerina/stdlib/ftp/client/FtpClient.java 72.05% 12 Missing and 7 partials ⚠️
...io/ballerina/stdlib/ftp/client/FtpRetryHelper.java 80.00% 7 Missing and 1 partial ⚠️
.../exception/FtpAllRetryAttemptsFailedException.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1531      +/-   ##
============================================
- Coverage     80.74%   80.38%   -0.36%     
- Complexity      816      831      +15     
============================================
  Files            61       63       +2     
  Lines          3620     3712      +92     
  Branches        609      621      +12     
============================================
+ Hits           2923     2984      +61     
- Misses          437      461      +24     
- Partials        260      267       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@niveathika niveathika force-pushed the retry branch 3 times, most recently from c61e229 to c637310 Compare February 2, 2026 18:23
@niveathika niveathika changed the title Retry Add retry support Feb 2, 2026
@niveathika niveathika marked this pull request as ready for review February 2, 2026 18:25
@niveathika niveathika added the Skip GraalVM Check This will skip the GraalVM compatibility check label Feb 2, 2026
Copy link
Contributor

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 automatic retry support with exponential backoff for FTP client read operations. When configured, the client will automatically retry failed read operations (getBytes, getText, getJson, getXml, getCsv) with configurable retry count, interval, backoff factor, and maximum wait interval.

Changes:

  • Added RetryConfig record type with configurable retry parameters (count, interval, backOffFactor, maxWaitInterval)
  • Implemented retry logic with exponential backoff in FtpRetryHelper class
  • Added new AllRetryAttemptsFailedError error type for when all retry attempts are exhausted
  • Wrapped all typed read operations (getBytes, getText, getJson, getXml, getCsv) with retry logic
  • Added comprehensive tests covering successful operations with retry config, retry exhaustion scenarios, and configuration validation

Reviewed changes

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

Show a summary per file
File Description
ballerina/commons.bal Added RetryConfig record type definition with default values
ballerina/client_endpoint.bal Added optional retryConfig field to ClientConfiguration
ballerina/error.bal Added AllRetryAttemptsFailedError distinct error type
ballerina/tests/retry_test.bal Added comprehensive retry behavior tests including success and failure scenarios
ballerina/tests/client_endpoint_test.bal Updated test expectations to include new retry directory
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpClient.java Wrapped typed read operations with retry logic and stored retry config in native data
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java Implemented core retry logic with exponential backoff
native/src/main/java/io/ballerina/stdlib/ftp/exception/FtpAllRetryAttemptsFailedException.java Added exception class for retry exhaustion
native/src/main/java/io/ballerina/stdlib/ftp/util/FtpConstants.java Added retry-related constants
native/src/main/java/io/ballerina/stdlib/ftp/util/FtpUtil.java Added AllRetryAttemptsFailedError enum value
test-utils/src/main/java/io/ballerina/stdlib/ftp/testutils/mockServerUtils/MockFtpServer.java Added retry test directory and file to mock server
docs/spec/spec.md Documented retry configuration and usage examples
changelog.md Added changelog entry for retry feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@niveathika niveathika merged commit 479ff18 into ballerina-platform:master Feb 3, 2026
10 of 14 checks passed
@niveathika niveathika deleted the retry branch February 16, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip GraalVM Check This will skip the GraalVM compatibility check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automatic retry support with exponential backoff for FTP client operations

3 participants