Skip to content

Commit 9b32d63

Browse files
author
Илья
committed
Added update discover property and check on empty discovery list
1 parent 7883c9e commit 9b32d63

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Traits/RequestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected function handleGrpcStatus($service, $method, $status)
179179
}catch (\Exception $e){}
180180
}
181181
$endpoint = $this->ydb->endpoint();
182-
if ($this->ydb->needDiscovery()){
182+
if ($this->ydb->needDiscovery() && count($this->ydb->cluster()->all()) > 0){
183183
$endpoint = $this->ydb->cluster()->all()[array_rand($this->ydb->cluster()->all())]->endpoint();
184184
}
185185
$this->client = new $this->client($endpoint,[

src/Ydb.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public function __construct($config = [], LoggerInterface $logger = null)
114114

115115
if (!empty($config['discovery']))
116116
{
117+
$this->discover = true;
117118
if (isset($config['discoveryInterval'])){
118119
$this->discoveryInterval = $config['discoveryInterval'];
119120
}

0 commit comments

Comments
 (0)