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

Replace reqwest with hyper client #114

Merged
merged 1 commit into from
Jan 7, 2023
Merged

Replace reqwest with hyper client #114

merged 1 commit into from
Jan 7, 2023

Conversation

calavera
Copy link
Contributor

@calavera calavera commented Jan 6, 2023

This reduces the size the of the final binary by 2.5MB. In the great scheme of things, 2.5MB is not much, but Lambda zip deploys have a combined hard limit of 250MB to fit the function's code and all the layers. Making this extension smaller means that there is a little bit more room for other things in the deploy.

The new code is completely equivalent to what reqwest was doing, without the additional layer of indirection and extra code.

Original size:

-rwxr-xr-x 2 david david 7.2M Jan  4 21:20 target/release/lambda-adapter

Size after these changes:

-rwxr-xr-x 2 david david 4.7M Jan  4 21:17 target/release/lambda-adapter

Signed-off-by: David Calavera david.calavera@gmail.com

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

@ferdingler

This reduces the size the of the final binary by 2.5MB.

Signed-off-by: David Calavera <david.calavera@gmail.com>

let (text, _, _) = encoding.decode(&body);
match text {
Cow::Owned(s) => Ok(LambdaBody::Text(s)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Clion complains that 's' is a "str", not "String". However, this code compiles with no issue. I'm a bit puzzled by this. It could be a bug in Clion Rust plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

CLion gives the same message for Reqwest. This is indeed an issue with CLion Rust plugin.

@calavera calavera merged commit f58556a into main Jan 7, 2023
@calavera calavera deleted the hyper_client branch January 7, 2023 02:46
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