File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,13 @@ private function getRequestWrapper(array $config): RequestWrapper
437437 return new RequestWrapper ($ config );
438438 }
439439
440+ /**
441+ * Returns a function that the RequestWrapper uses between retries. In our listener we modify the call options
442+ * to add the `retryAttempt` field to the call options for our Auth httpHandler logging logic. This way, the logging
443+ * logic has access to the retry attempt.
444+ *
445+ * @return callable
446+ */
440447 private function getRetryListener (): callable
441448 {
442449 return function (Exception $ ex , int $ retryAttempt , array &$ arguments ) {
Original file line number Diff line number Diff line change @@ -774,13 +774,13 @@ public function testRetryLogging()
774774 new Response (200 , [], json_encode (['access_token ' => 'token ' ]))
775775 ]);
776776
777- $ retryHeaderAppeared = false ;
777+ $ retryCallOptionAppeared = false ;
778778 $ logger = $ this ->prophesize (LoggerInterface::class);
779779 $ logger ->debug (
780- Argument::that (function (string $ jsonString ) use (&$ retryHeaderAppeared ) {
780+ Argument::that (function (string $ jsonString ) use (&$ retryCallOptionAppeared ) {
781781 $ jsonParsed = json_decode ($ jsonString , true );
782782 if (isset ($ jsonParsed ['jsonPayload ' ]['retryAttempt ' ])) {
783- $ retryHeaderAppeared = true ;
783+ $ retryCallOptionAppeared = true ;
784784 }
785785 return true ;
786786 })
@@ -809,6 +809,6 @@ public function testRetryLogging()
809809 );
810810
811811 $ client ->startQuery ($ queryConfig );
812- $ this ->assertTrue ($ retryHeaderAppeared );
812+ $ this ->assertTrue ($ retryCallOptionAppeared );
813813 }
814814}
You can’t perform that action at this time.
0 commit comments