Skip to content

Commit b1d59b6

Browse files
committed
Add description to the getRetryListener method
1 parent 9f0625b commit b1d59b6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

BigQuery/src/Connection/Rest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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) {

BigQuery/tests/Unit/BigQueryClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)