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 curl callback data latency for clients with response stream #3245

Merged
merged 12 commits into from
Jan 17, 2025
Merged

Conversation

sbera87
Copy link
Contributor

@sbera87 sbera87 commented Jan 14, 2025

Issue #, if available:

Description of changes:

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbera87 sbera87 changed the title Test for debugging/profiling (Ignore ) Fix curl callback data latency for clients with response stream Jan 14, 2025
@@ -203,6 +203,11 @@ namespace Aws

virtual Aws::Client::CompressionAlgorithm
GetSelectedCompressionAlgorithm(Aws::Client::RequestCompressionConfig) const { return Aws::Client::CompressionAlgorithm::NONE; }
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

please move it up right after IsEventStreamRequest
please also use a consistent docstring style of this file

        /**
         * Defaults to false, if this is set to true in derived class, the operation using this request will return an event stream response.
         */
        inline virtual bool HasEventStreamResponse() const { return false; }

@sbera87 sbera87 requested a review from sbiscigl January 14, 2025 21:05
@@ -289,7 +289,7 @@ HttpResponseOutcome AWSClient::AttemptExhaustively(const Aws::Http::URI& uri,
false/*retryable*/));

};
httpRequest->SetEventStreamRequest(request.IsEventStreamRequest());
httpRequest->SetEventStreamRequest(request.IsEventStreamRequest() || request.HasEventStreamResponse());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't overload IsEventStreamRequest boolean in the HttpRequest object, it may create unwanted side-effects of how the request is sent.
Instead, create a new boolean flag at set it accordingly.


void WriteDataToStream(Aws::Kinesis::KinesisClient &kinesis_client, const std::string &streamName, const std::string &data, const std::string &partitionKey)
{
std::cout<<"WriteDataToStream called"<<std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove debug traces, our tests typically do not trace to stdout on success.
you can use SCOPED_TRACE() macro of gtest to add additional context to the test that will be dumped to stdout on failure.

if (putRecordOutcome.IsSuccess()) {
std::cout << "Successfully put record into stream: " << data << std::endl;
} else {
std::cout << "Error putting record into stream: "
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we fail the test in this case and don't proceed further?

@@ -13,7 +13,7 @@ int main(int argc, char** argv)
{
Aws::Testing::SetDefaultSigPipeHandler();
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a part of this change.

@@ -291,6 +291,10 @@ protected SdkFileEntry generateModelHeaderFile(ServiceModel serviceModel, Map.En
if (op.getRequest() != null && op.getRequest().getShape().getName() == shape.getName()) {
context.put("operation", op);
context.put("operationName", key);
if((op.getResult() != null) && op.getResult().getShape().hasEventStreamMembers())
Copy link
Contributor

Choose a reason for hiding this comment

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

java does not use K&R C curly braces format.

@sbera87 sbera87 merged commit 573ecfe into main Jan 17, 2025
4 of 5 checks passed
@sbera87 sbera87 deleted the kinesis2 branch January 24, 2025 17:08
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.

3 participants