Skip to content

Conversation

@SimonUnge
Copy link
Collaborator

Add put API

Proposed Changes

Please describe the big picture of your changes here to communicate to the RabbitMQ team why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

A pull request that doesn't explain why the change was made has a much lower chance of being accepted.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution
you did and what alternatives you considered, etc.

@SimonUnge SimonUnge requested a review from lukebakken July 29, 2025 18:47
@mergify mergify bot added the make label Jul 29, 2025
Comment on lines +622 to +623
StreamRef = do_gun_request(ConnPid, Method, Path, HeadersBin, Body),
case gun:await(ConnPid, StreamRef, Timeout) of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of synchronously awaiting the replies we should try to use gun's async API https://ninenines.eu/docs/en/gun/2.2/manual/gun_response/

With that we can avoid blocking this gen_server: we can start the request with gun:post/gun:get/..., store the StreamRef in state and and in the handle_call/3 impl return {noreply, State}. Then once the {gun_response, ..} message arrives we can use gen_server:reply/2 to notify the caller. Then the gen_server can start other requests as other requests are in-flight.

This would be a big improvement over httpc:request/4 since that is always synchronous

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can the functions in rabbitmq_aws actually benefit from this though?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently this gen_server blocks for any request so you can't download two files from S3 for example in parallel. It could also make sense to get rid of this server or change it so it's only in charge of refreshing credentials. Then callers could interact with the gun connection processes directly without the extra hop to this server first

@SimonUnge SimonUnge closed this Aug 1, 2025
@michaelklishin
Copy link
Collaborator

@SimonUnge if you don't need the branch any more, can you please delete it? Thank you.

@the-mikedavis the-mikedavis deleted the su_aws/replace_httpc_with_gun branch August 3, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants