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 Issue #1861: Client request timeout parameters are inconsistent #1862

Merged
merged 1 commit into from
May 2, 2017

Conversation

ykshatroff
Copy link
Contributor

What do these changes do?

Use sentinel (instead of None) for checking the timeout arguments passed.

aiohttp/client.py:

  • ClientSession.init():
    • set the read_timeout argument default value to sentinel
    • if it is equal to sentinel during the call, set it to the value of DEFAULT_TIMEOUT
  • ClientSession._request():
    • set the timeout argument default value to sentinel
    • if it is equal to sentinel during the call, set it to the value of self.read_timeout

Update documentation to match the consistent usage of timeouts.
Update tests (excluding the confusing timeout=None argument usage).

Are there changes in behavior for the user?

  • The read_timeout argument to ClientSession constructor, when omitted, now defaults to DEFAULT_TIMEOUT which is 5 min, and not to None which is no timeout.
  • The timeout argument should be omitted in session's request() methods in order to use the session's read_timeout.
  • The timeout argument explicitly passed as None to session's request() methods now disables the request timeout instead of resulting in the session's read_timeout being used.

Related issue number

Issue #1861 Client request timeout parameters are inconsistent

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new entry to CHANGES.rst
    • Choose any open position to avoid merge conflicts with other PRs.
    • Add a link to the issue you are fixing (if any) using #issue_number format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.

…istent

Use sentinel (instead of None) for checking the arguments passed.

aiohttp/client.py:
* ClientSession.__init__():
  * set the `read_timeout` argument default value to `sentinel`
  * if it is equal to `sentinel` during the call, set it to the value of `DEFAULT_TIMEOUT`
* ClientSession._request():
  * set the `timeout` argument default value to `sentinel`
  * if it is equal to `sentinel` during the call, set it to the value of `self.read_timeout`

Update documentation to match the consistent usage of timeouts.
Update tests (excluding the confusing `timeout=None` argument usage).
@codecov-io
Copy link

codecov-io commented Apr 30, 2017

Codecov Report

Merging #1862 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1862   +/-   ##
=======================================
  Coverage   97.19%   97.19%           
=======================================
  Files          37       37           
  Lines        7533     7533           
  Branches     1308     1308           
=======================================
  Hits         7322     7322           
  Misses         89       89           
  Partials      122      122
Impacted Files Coverage Δ
aiohttp/client.py 97.09% <100%> (ø) ⬆️

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 9522ba6...278fd80. Read the comment docs.

@fafhrd91
Copy link
Member

fafhrd91 commented May 2, 2017

thanks!

@fafhrd91 fafhrd91 merged commit 160b8e7 into aio-libs:master May 2, 2017
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants