Skip to content
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

Fix resilient client failure in passthrough #1762

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Sep 22, 2023

Purpose

Fixes ballerina-platform/ballerina-library#4824

Examples

import ballerina/http;
import ballerina/log;

public type Data record {|
    string name;
    int age;
    string[] address;
|};

final http:Client clientEP = check new ("http://localhost:9090", retryConfig = {
    count: 3,
    interval: 10
});

service on new http:Listener(9091) {

    resource function post data(Data[] data) returns http:Response? {
        do {
            return check clientEP->/data.post(data);
        } on fail error err {
            log:printError("Error: ", err);
            return;
        }
    }
}

This was failing before when we try to build the binary payload for the request where the data source is already available. This fix will check the availability of the data source before trying to build the payload as byte[].

Checklist

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

@TharmiganK TharmiganK marked this pull request as ready for review September 22, 2023 07:21
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 81.81% and project coverage change: +0.26% 🎉

Comparison is base (35cf9a2) 81.36% compared to head (b4c41cc) 81.63%.
Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1762      +/-   ##
============================================
+ Coverage     81.36%   81.63%   +0.26%     
- Complexity        0      562     +562     
============================================
  Files           357      394      +37     
  Lines         19591    21352    +1761     
  Branches       4427     4779     +352     
============================================
+ Hits          15940    17430    +1490     
- Misses         2809     2939     +130     
- Partials        842      983     +141     
Files Changed Coverage Δ
ballerina/redirect_http_client.bal 77.52% <75.00%> (+0.10%) ⬆️
ballerina/resiliency_failover_client.bal 83.48% <75.00%> (+0.36%) ⬆️
ballerina/resiliency_http_retry_client.bal 65.60% <75.00%> (+0.22%) ⬆️
ballerina/resiliency_load_balance_client.bal 83.33% <75.00%> (+0.65%) ⬆️
ballerina/http_request.bal 83.49% <100.00%> (+0.21%) ⬆️
...rina/stdlib/http/api/nativeimpl/ExternRequest.java 87.87% <100.00%> (+0.78%) ⬆️

... and 44 files with indirect coverage changes

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

@TharmiganK TharmiganK closed this Sep 22, 2023
@TharmiganK TharmiganK reopened this Sep 22, 2023
Co-authored-by: Dilan Sachintha Nayanajith <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@TharmiganK TharmiganK merged commit ec4e2ea into master Sep 27, 2023
8 checks passed
@TharmiganK TharmiganK deleted the fix-resilient-passthrough-client branch September 27, 2023 04:24
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.

[Bug] Retry client call in a passthrough scenario is failing for json[] payload
3 participants