-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add keepalive_timeout parameter to web.run_app #5095
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5095 +/- ##
==========================================
+ Coverage 97.63% 97.64% +0.01%
==========================================
Files 43 43
Lines 8999 8999
Branches 1413 1413
==========================================
+ Hits 8786 8787 +1
+ Misses 99 98 -1
Partials 114 114
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the initial review from me below. It's non-blocking but I don't have the confidence to accept this change on my own either and thus I defer the decision on whether it's something that we want to @asvetlov.
tests/test_run_app.py
Outdated
@@ -685,6 +686,24 @@ async def on_startup(app): | |||
exc_handler.assert_called_with(patched_loop, msg) | |||
|
|||
|
|||
def test_run_app_keepalive_timeout(patched_loop): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's usually better to use the mocker
fixture from pytest-mock
(it's already integrated as a test dependency) for accessing the MagicMock
class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can update it. What exactly is the benefit of using the fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the consistency: if the lib is integrated, the expectation is that it would be used. Also, pytest design is more fixture-driven so external things seem foreign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I can change this (and the rest of the comments) if @asvetlov agrees with the feature itself.
tests/test_run_app.py
Outdated
base_runner_init_mock(*args, **kwargs) | ||
base_runner_init_orig(self, *args, **kwargs) | ||
|
||
with mock.patch.object(BaseRunner, "__init__", base_runner_init_spy): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use the built-in monkeypatch
fixture for patching things.
Also, it's best to only patch the line that relies on patching, not many lines because you may accidentally create unintended side-effects with this.
tests/test_run_app.py
Outdated
base_runner_init_orig = BaseRunner.__init__ | ||
|
||
def base_runner_init_spy(self, *args, **kwargs): | ||
base_runner_init_mock(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it'd be much cleaner to just do
base_runner_init_mock(*args, **kwargs) | |
assert kwargs["keepalive_timeout"] == new_timeout |
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
@webknjaz please feel free to merge the PR when you are okay with it. |
Co-authored-by: Andrew Svetlov <[email protected]>
docs/web_reference.rst
Outdated
@@ -2798,6 +2798,8 @@ Utilities | |||
closed after a HTTP request. The delay | |||
allows for reuse of a TCP connection. | |||
|
|||
.. versionadded:: 3.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionadded:: 3.7 | |
.. versionadded:: 3.8 |
Sorry, the time window for 3.1 is closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood.
@asvetlov is there any agreed-upon autoformatting tool that could help me resolve the conflicts? |
You can try the following:
|
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
💔 Backport was not successfulThe PR was attempted backported to the following branches:
|
PR #5095 by @Teyras Co-authored-by: Sviatoslav Sydorenko <[email protected]> Co-authored-by: Andrew Svetlov <[email protected]>
@webknjaz please backport manually next time if the bot fails. |
Oh, I probably missedmisse that among my notifications. I think it's also a good idea to encourage the submitters to do their backports when they are as interested in the change. |
Agree, ask for the submitter to make backport PR using |
For the note, backported to 3.8 by e88dc8a |
PR aio-libs#5095 by @Teyras Co-authored-by: Sviatoslav Sydorenko <[email protected]> Co-authored-by: Andrew Svetlov <[email protected]>
PR aio-libs#5095 by @Teyras Co-authored-by: Sviatoslav Sydorenko <[email protected]> Co-authored-by: Andrew Svetlov <[email protected]>
What do these changes do?
Add keepalive_timeout parameter to web.run_app. Closes #5094.
Are there changes in behavior for the user?
Unlikely.
Related issue number
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.