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

Proposal for configuration of ceiling timeout value threshold #6286

Closed

Conversation

hlecnt
Copy link
Contributor

@hlecnt hlecnt commented Nov 10, 2021

What do these changes do?

Proposal to restore former aiohttp version (<3.7) regarding the timeout handling.
More details are available here this discussion

Are there changes in behavior for the user?

By default, no behavior changes compared to aiohttp versions >=3.7

Related issue number

No issue tracked.

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 news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .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.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@@ -74,6 +74,12 @@
sentinel: _SENTINEL = _SENTINEL(object())
NO_EXTENSIONS = bool(os.environ.get("AIOHTTP_NO_EXTENSIONS")) # type: bool

CEIL_TIMEOUT_THRESHOLD: float = 5
try:
CEIL_TIMEOUT_THRESHOLD = float(os.environ.get("AIOHTTP_CEIL_TIMEOUT_THRESHOLD", 5))
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want to configure anything with environment variables in the core library. That's the domain of applications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the cause of the performance drop was introduced to achieve tests faster in a testing environment (different of production environment), I supposed that an environment variable would be acceptable as a global parameter. Performing tests faster should be done for sure, modifying the default core behavior for that ... Im' not sure.
Nevertheless I understand your requirements and I'll try to find another way to do it.

Functions handling timeouts are present in the helpers module and don't know anything about the app and its context. Adding app level configuration will need more work.

Maybe you have some tricks or ideas to easily pass app context info to the helpers module functions ?

Copy link
Member

Choose a reason for hiding this comment

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

I concur with @Dreamsorcerer
We use env wars for disabling C Extensions only IIRC.
Env wars are handy for application development (and I use them on my job extensively, sure).
But a library should configure everything explicitly.
Yes, it requires much more work but this requirement is one of the aiohttp design rules.
Other libraries can have other rules, that's fine. Every software engineer is free to choose tools that one wants to use.

There is no trick to pass ClientSession settings down to helpers. Maybe contextvars can be used for such global-like things but I strongly ask for using old-good explicit arguments passing in aiohttp.
Please leave the implicitness to aiohttp users, not to the library itself.
Thanks for the understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your answer.

I'm working on a second version using old-good explicit arguments passing in aiohttp. When finished, I'll close this draft PR and I'll create a new one.

Copy link
Member

Choose a reason for hiding this comment

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

Cool! Thanks!

@hlecnt hlecnt closed this Nov 16, 2021
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.

3 participants