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

Avoid timeout caused by Request with large body #768

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

quertenmont
Copy link
Contributor

I am frequently facing timeout because of request with very large body,
These are caused by body processing in request details to generate curl and client commands that are not so essential in most cases (in particular when working with large request)

Copy link
Member

@albertyw albertyw left a comment

Choose a reason for hiding this comment

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

Notes:

  • Attempting json.loads on all requests is going to be computationally heavy (though the code has been doing it for a while)
  • request.html both have existence checks for curl and client so they should be fine if this if condition is not executed. It would be nice to have tests for both cases (<20000 and >20000) to prevent regression.
  • This is a semi backwards incompatible change in that some users' requests will stop showing curl and client requests. It would be more elegant for some explanatory text to appear rather than simply the sections in the html output just disappearing.

Copy link
Member

@albertyw albertyw left a comment

Choose a reason for hiding this comment

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

Requesting changes pending passing tests

@quertenmont
Copy link
Contributor Author

Hello @albertyw
The test which are failing the PR have clearly nothing to do with my changes, so I am not quite sure what I should do to make this PR move on

can you give some suggestions please ?

Loic,

'request': request
}

if len(silk_request.raw_body < 20000): # Don't do this for large request
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if len(silk_request.raw_body < 20000): # Don't do this for large request
if len(silk_request.raw_body) < 20000: # Don't do this for large request

@quertenmont
Copy link
Contributor Author

Oups, my bad.
Thanks for spotting this @albertyw

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.26%. Comparing base (6107031) to head (3305afe).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #768      +/-   ##
==========================================
+ Coverage   87.10%   87.26%   +0.15%     
==========================================
  Files          52       52              
  Lines        2141     2144       +3     
==========================================
+ Hits         1865     1871       +6     
+ Misses        276      273       -3     

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

@albertyw albertyw merged commit 0a84caa into jazzband:master Feb 3, 2025
105 checks passed
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