From 837b8aa56108603be9d4ce9cb06e6049a3288b1c Mon Sep 17 00:00:00 2001 From: Jeroeny Date: Sat, 2 Oct 2021 12:11:06 +0200 Subject: [PATCH] reset TraceableHttpClient(s) on reset() and separate data reset into resetData method --- .../DataCollector/HttpClientDataCollector.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php index 9247b7479a4e1..d8305ee638460 100644 --- a/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php +++ b/src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php @@ -39,7 +39,7 @@ public function registerClient(string $name, TraceableHttpClient $client) */ public function collect(Request $request, Response $response/*, \Throwable $exception = null*/) { - $this->reset(); + $this->resetData(); foreach ($this->clients as $name => $client) { [$errorCount, $traces] = $this->collectOnClient($client); @@ -85,6 +85,14 @@ public function getName(): string } public function reset() + { + $this->resetData(); + foreach ($this->clients as $client) { + $client->reset(); + } + } + + private function resetData() { $this->data = [ 'clients' => [],