-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(cts): add client test for retry strategy #2633
Changes from all commits
3594a6c
d7b8935
72383b8
f145701
0e4f56e
1cace3a
80a320c
ef89edf
89a511c
dfe1135
d863cae
042ad82
58142e1
2bd5247
e627569
667d469
8625bb4
6cbf32f
bc978ff
7601180
6a47dad
89b7ab4
8aa5b27
49f8623
b45cbc9
b8e4833
b46bcc9
8d5a419
0aa6b22
f502718
ccc6a04
6df79be
bb7ad1f
1f13a0d
dd2c423
1f9aeaa
e9f9ce5
33be0c9
aec6b7c
93ec181
5e736f2
f248bc8
6fd9084
c25519d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.11 | ||
1.0.13 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ final class ApiWrapper implements ApiWrapperInterface | |
*/ | ||
private $clusterHosts; | ||
|
||
/** | ||
* @var Configuration | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @var RequestOptionsFactory | ||
*/ | ||
|
@@ -57,6 +62,7 @@ public function __construct( | |
) { | ||
$this->http = $http; | ||
$this->clusterHosts = $clusterHosts; | ||
$this->config = $config; | ||
$this->requestOptionsFactory = | ||
$RqstOptsFactory ?: new RequestOptionsFactory($config); | ||
$this->logger = $logger ?: Algolia::getLogger(); | ||
|
@@ -148,7 +154,16 @@ private function request( | |
|
||
$retry = 1; | ||
foreach ($hosts as $host) { | ||
$uri = $uri->withHost($host); | ||
if ($this->config->getHasFullHosts()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so IIUC the user has to explicitly call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, if they want to specify a different scheme/port, they need to use |
||
$host = explode(':', $host); | ||
$uri = $uri->withHost(trim($host[1], '/')) | ||
->withScheme($host[0]) | ||
->withPort($host[2]) | ||
; | ||
} else { | ||
$uri = $uri->withHost($host); | ||
} | ||
|
||
$request = null; | ||
$logParams['retryNumber'] = $retry; | ||
$logParams['host'] = (string) $uri; | ||
|
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'm not sure why we have a mix of scheme and protocol in the clients
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 guess it's from the legacy, I can rename everything if you want, but I have no preference
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.
idk the real definition of both I guess there's some overlap? to me scheme is
http
orhttps
and protocol is how we transfer data, which is defined by the scheme?idk idk up to you
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 prefer scheme anyway
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.
to many idk ahah
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.
ahahah that's my state of mind