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

Allow disabling sendfile w/ env 'AIOHTTP_NOSENDFILE=1' #629

Merged
merged 1 commit into from
Nov 10, 2015

Conversation

jashandeep-sohi
Copy link
Contributor

StaticRoute can now be forced to not use sendfile system call if environment variable AIOHTTP_NOSENDFILE=1.

See issue #628

asvetlov added a commit that referenced this pull request Nov 10, 2015
Allow disabling sendfile w/ env 'AIOHTTP_NOSENDFILE=1'
@asvetlov asvetlov merged commit 2834235 into aio-libs:master Nov 10, 2015
@asvetlov
Copy link
Member

Perfect!

@imbusy
Copy link

imbusy commented Nov 10, 2015

Wouldn't it be better to do this in line 257 of web_urldispatcher.py, where the implementation of sendfile is chosen?

@asvetlov
Copy link
Member

Maybe you are right. I dont care too much honestly

@jashandeep-sohi
Copy link
Contributor Author

I wouldn't be able to mock.patch.dict(os.environ, ...) in the tests then.

Perhaps, the other section should be moved into the constructor as well, so we can mock test that as well and get rid of no coverage pragma.

It's fine for now, but it's something to consider in the static route refactoring (issue #468)

@@ -163,6 +163,9 @@ def __init__(self, name, prefix, directory, *,
raise ValueError(
"No directory exists at '{}'".format(self._directory))

if os.environ.get("AIOHTTP_NOSENDFILE") == "1":
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned that definition of this environment variable switch is differs from other environment variable switches used in asyncio/aiohttp.

AIOHTTP_NO_EXTENSIONS is checked in the following way:

if bool(os.environ.get('AIOHTTP_NO_EXTENSIONS')):

At least inside aiohttp library environment variables switches should work in the same way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was fixed after the merge: 9dc529b

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks!

@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.

4 participants