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

[StaticRoute] Add preliminary support for sendfile system call. #503

Merged
merged 11 commits into from
Sep 15, 2015

Conversation

jashandeep-sohi
Copy link
Contributor

This is a first draft of sendfile support. Not merge ready, yet. Please critique.

The tests probably need some work. Should we test every static file test with both sendfile and sendfile_fallback?

#398

@@ -145,7 +145,7 @@ class StaticRoute(Route):

def __init__(self, name, prefix, directory, *,
expect_handler=None, chunk_size=256*1024,
response_factory=None):
response_factory=None, sendfile_fallback=False):
Copy link
Member

Choose a reason for hiding this comment

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

Fallback should be performed automatically.
User doesn't know (and doesn't care) is underlying OS support sendfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but it's useful to force the use of the fallback sendfile in the tests. That's the primary reason why the option exists.
But fallback is done automatically if sendfile_fallback=False. This should really be named force_sendfile_fallback, but that's too long.

Copy link
Member

Choose a reason for hiding this comment

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

Public API is made not for tests, but for users. There is no need to pollute it with special flags, while you may call exact sendfile function in tests.

@asvetlov
Copy link
Member

Yes, all tests should be passed with sendfile and fallback.
Mixin to TestCase can help avoid test code duplication.

asvetlov added a commit that referenced this pull request Sep 15, 2015
[StaticRoute] Add preliminary support for sendfile system call.
@asvetlov asvetlov merged commit 9083167 into aio-libs:master Sep 15, 2015
@asvetlov
Copy link
Member

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.

3 participants