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

[2201.7.x] Fix resilient client failure in passthrough #1761

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Sep 22, 2023

Purpose

Related to 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.04% 🎉

Comparison is base (bcdbb97) 81.57% compared to head (aafc895) 81.62%.
Report is 7 commits behind head on 2201.7.x.

Additional details and impacted files
@@              Coverage Diff               @@
##             2201.7.x    #1761      +/-   ##
==============================================
+ Coverage       81.57%   81.62%   +0.04%     
  Complexity        577      577              
==============================================
  Files             393      393              
  Lines           21399    21409      +10     
  Branches         4792     4798       +6     
==============================================
+ Hits            17457    17475      +18     
+ Misses           2943     2937       -6     
+ Partials          999      997       -2     
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 8 files with indirect coverage changes

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

@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 d10375e into 2201.7.x Sep 27, 2023
7 checks passed
@TharmiganK TharmiganK deleted the fix-resilient-passthrough-client-7.x 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.

2 participants