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: max httpApi timeout #10119

Merged
merged 3 commits into from
Oct 29, 2021
Merged

Conversation

CaioFauza
Copy link
Contributor

Closes: #9677

The issue pointed out that the time margin was not being added to the maximum timeout value. The Math.min method was considering 29 as the maximum value, therefore, when passing the limit value, the additional 0.5 seconds was not considered.

I also added a new unit test to consider the case.

@codecov
Copy link

codecov bot commented Oct 20, 2021

Codecov Report

Merging #10119 (a7907e4) into master (b4ff87d) will increase coverage by 0.11%.
The diff coverage is 89.18%.

❗ Current head a7907e4 differs from pull request most recent head 112338c. Consider uploading reports for the commit 112338c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10119      +/-   ##
==========================================
+ Coverage   85.27%   85.38%   +0.11%     
==========================================
  Files         335      339       +4     
  Lines       13687    13819     +132     
==========================================
+ Hits        11671    11800     +129     
- Misses       2016     2019       +3     
Impacted Files Coverage Δ
commitlint.config.js 0.00% <ø> (ø)
bin/serverless.js 39.13% <50.00%> (-10.87%) ⬇️
lib/classes/Service.js 85.71% <76.00%> (+0.19%) ⬆️
lib/cli/triage.js 90.80% <90.80%> (ø)
commands/doctor.js 90.90% <90.90%> (ø)
lib/cli/commands-schema/no-service.js 100.00% <100.00%> (ø)
lib/cli/handle-error.js 81.08% <100.00%> (ø)
lib/cli/render-help/general.js 98.11% <100.00%> (ø)
lib/plugins/aws/deployFunction.js 97.04% <100.00%> (ø)
lib/plugins/aws/info/display.js 75.67% <100.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4ff87d...112338c. Read the comment docs.

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@CaioFauza thanks for an initiative, still please see my comment

@@ -642,7 +642,7 @@ Object.defineProperties(
// It's a margin needed for some side processing time on AWS side.
// Otherwise there's a risk of observing 503 status for successfully resolved invocation
// (which just fit function timeout setting)
routeTargetData.timeout = Math.min(functionTimeout + 0.5, 29);
routeTargetData.timeout = Math.min(functionTimeout + 0.5, 29.5);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will allow 29.5 as endpoint timeout, while maximum supported on HTTP API side is 29

Also please see my comment at: #9677 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Here simply let's also update it to 30

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@CaioFauza Looks great. I have just one suggestion

@@ -642,7 +642,7 @@ Object.defineProperties(
// It's a margin needed for some side processing time on AWS side.
// Otherwise there's a risk of observing 503 status for successfully resolved invocation
// (which just fit function timeout setting)
routeTargetData.timeout = Math.min(functionTimeout + 0.5, 29);
routeTargetData.timeout = Math.min(functionTimeout + 0.5, 29.5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here simply let's also update it to 30

@CaioFauza
Copy link
Contributor Author

@CaioFauza Looks great. I have just one suggestion

Done! I just added one more unit test to grant coverage to the new 30s case as well.

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @CaioFauza !

@medikoo medikoo merged commit e3e02fe into serverless:master Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow HTTP API timeout up to 30 seconds
3 participants