Skip to content

[HttpClient] fix pausing AmpResponse #37578

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

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Conversation

kelunik
Copy link
Contributor

@kelunik kelunik commented Jul 14, 2020

Q A
Branch? master
Bug fix? yes
New feature? no
Deprecations? no
Tickets None
License MIT
Doc PR None

This fixes the pause handler while streaming bodies in AmpHttpClient.

Needs to be rebased onto the target branch and needs some test fixes. @nicolas-grekas FYI.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Thanks for having a look, the previous logic relied on Loop::disable($id)/enable($id) to throttle a specific request, but I admit I didn't test it in-depth and a proper delay could work better.
Looking forward to v2.5.0

@kelunik
Copy link
Contributor Author

kelunik commented Jul 16, 2020

Loop::disable($id)/enable($id) only works before the request has been sent.

@nicolas-grekas nicolas-grekas added this to the next milestone Jul 22, 2020
@nicolas-grekas nicolas-grekas changed the title Amp pause handler [HttpClient] fix pausing AmpResponse Jul 22, 2020
@kelunik kelunik marked this pull request as ready for review July 22, 2020 19:56
@kelunik
Copy link
Contributor Author

kelunik commented Jul 28, 2020

@nicolas-grekas Tests for Amp's implementation pass, but Native / Mock needs work. Could you have a look at those?

@@ -348,6 +362,8 @@ private static function followRedirects(Request $originRequest, AmpClientState $
$request->removeHeader('host');
}

yield $pause;
Copy link
Member

Choose a reason for hiding this comment

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

I moved to pause in this method.

Loop::enable($id);
}
});
$pause = $pauseDeferred->promise();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolas-grekas I guess this line should be below the following if, no?

Copy link
Member

Choose a reason for hiding this comment

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

You wrote it this way, and I'm not sure it should be moved below. Can you please confirm?

@fabpot
Copy link
Member

fabpot commented Aug 27, 2020

Thank you @kelunik.

@fabpot fabpot merged commit 4002297 into symfony:master Aug 27, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants