Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

don't flush on every body part#214

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
artemredkin wants to merge1 commit intoswift-server:main
base:main
Choose a base branch
Loading
fromartemredkin:dont_flush_on_every_part

Conversation

@artemredkin
Copy link
Collaborator

Right now we callflush on every body part write, this can be suboptimal,closes#203

Motivation:
Library users can write data in small chunk, in this case we are not buffering enough data, better solution would be to buffer at the NIO level in this case.

Modifications:
Body part write is not not flushing, justwrite

Result:
Body part writes are not flushing anymore

Copy link
Contributor

@weissiweissi left a comment

Choose a reason for hiding this comment

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

I don't think this achieves quite what we want

return body.stream(HTTPClient.Body.StreamWriter{ partin
context.eventLoop.assertInEventLoop()
returncontext.writeAndFlush(self.wrapOutboundOut(.body(part))).map{
context.write(self.wrapOutboundOut(.body(part))).whenSuccess{
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, this would nownever flush any body which means we'll load the whole body into memory before sending.

I think the right thing to do is:

  • if you know that whole body straight away (without streaming), then we should do
    write(.head),.write(.body),.write(end),flush
  • if we actually want to stream the body, then
    writeAndFlush(.head),writeAndFlush(.body),writeAndFlush(.end)

Copy link
Contributor

Choose a reason for hiding this comment

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

We also need a test actually that shows that this PR doesn't work. We should have a test which checks that body chunks do arrive at the other end before the next bit is sent out.

Copy link
Contributor

Choose a reason for hiding this comment

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

wrote#219 to test this. This PR should go in after#219 to prove that it works.

@ktosoktoso changed the base branch frommaster tomainAugust 20, 2020 01:30
@ktoso
Copy link
Contributor

Just as a heads up, the main development branch has been changed tomain, following theSwift policy on this.

This PR has been re-targeted to main and should just work. However when performing rebases etc please keep this in mind -- you may want to fetch the main branch and rebase onto themain branch from now on since master is not up-to-date anymore and is going to be deleted shortly.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@weissiweissiweissi requested changes

@LukasaLukasaAwaiting requested review from Lukasa

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AsyncHTTPClient calls flush after writing each part of the HTTP message

3 participants

@artemredkin@ktoso@weissi

[8]ページ先頭

©2009-2025 Movatter.jp