Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpClient] Add a Stopwatch on TraceableHttpClient#38688
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Nyholm left a comment
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.
This is an excellent idea. Thank you
| } | ||
| foreach ($client->stream($wrappedResponses,$timeout)as$r =>$chunk) { | ||
| if ($traceableMap[$r]->event &&$traceableMap[$r]->event->isStarted() &&$chunk->isLast()) { |
nicolas-grekasOct 23, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
calling isLast() without checking for getError will throw when an error happens (same for timeouts)
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.
Good catch.
I addedlap on timeout and chunk (same forgetStatus andgetHeader) To show a "tick" when content is partially received.
$response1 =$client->request('GET','https://httpstat.us/200');$response1->getContent(false);$response2 =$client->request('GET','https://httpstat.us/404');$response2->getContent(false);$responses[] =$client->request('GET','https://httpstat.us/200?sleep=3000');$responses[] =$client->request('GET','https://httpstat.us/200?sleep=500');try {foreach ($client->stream($responses,1)as$chunk) {} }catch (\Exception$e) {}sleep(1);foreach ($responsesas$response) {$response->getContent(); }
bcab52a to5759497CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
a7f9109 toff928bcComparefabpot commentedOct 23, 2020
Thank you@jderusse. |

Uh oh!
There was an error while loading.Please reload this page.
I used this code to generate the screenshot below.