-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
There was a problem hiding this 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
|
@nicolas-grekas Tests for Amp's implementation pass, but |
114fae0
to
f231495
Compare
@@ -348,6 +362,8 @@ private static function followRedirects(Request $originRequest, AmpClientState $ | |||
$request->removeHeader('host'); | |||
} | |||
|
|||
yield $pause; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
f231495
to
bf2d1cf
Compare
Thank you @kelunik. |
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.