Skip to content

Commit

Permalink
fix 注册实例未根据配置设置enable
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Dec 15, 2023
1 parent 7f7357d commit 577f0e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/Process/InstanceRegistrarProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public function onWorkerStart(Worker $worker)
foreach ($instanceRegistrars as $name => $instanceRegistrar){
// 拆解配置
list($serviceName, $ip, $port, $option) = $instanceRegistrar;
$option['enabled'] = is_bool($option['enabled']) ? ($option['enabled'] ? 'true' : 'false') : $option['enabled'];
// 注册
$promises[] = $this->client->instance->registerAsync($ip, $port, $serviceName, $option)
->then(function (ResponseInterface $response) use ($instanceRegistrar, $name) {
Expand Down
30 changes: 15 additions & 15 deletions src/Provider/InstanceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public function register(string $ip, int $port, string $serviceName, array $opti
* @param int $port
* @param string $serviceName
* @param array $optional = [
* 'groupName' => '',
* 'groupName' => '',
* 'clusterName' => '',
* 'namespaceId' => '',
* 'weight' => 99.0,
* 'metadata' => '',
* 'enabled' => true,
* 'ephemeral' => false, // 是否临时实例
* 'weight' => 99.0,
* 'metadata' => '',
* 'enabled' => 'true', // 是否上线
* 'ephemeral' => 'false', // 是否临时实例
* ]
* @return bool|PromiseInterface
* @throws GuzzleException
Expand All @@ -103,10 +103,10 @@ public function registerAsync(string $ip, int $port, string $serviceName, array
* 'groupName' => '',
* 'clusterName' => '',
* 'namespaceId' => '',
* 'weight' => 99.0,
* 'metadata' => '',
* 'enabled' => true,
* 'ephemeral' => false, // 是否临时实例
* 'weight' => 99.0,
* 'metadata' => '',
* 'enabled' => 'true', // 是否上线
* 'ephemeral' => 'false', // 是否临时实例
* ]
* @param callable|null $success = function(\Workerman\Http\Response $response){}
* @param callable|null $error = function(\Exception $exception){}
Expand Down Expand Up @@ -228,8 +228,8 @@ public function deleteAsyncUseEventLoop(array $options, array $optional = [], ?c
* 'namespaceId' => '',
* 'weight' => 0.99,
* 'metadata' => '', // json
* 'enabled' => false,
* 'ephemeral' => false,
* 'enabled' => 'false',
* 'ephemeral' => 'false',
* ]
* @return bool|string
* @throws GuzzleException
Expand All @@ -255,8 +255,8 @@ public function update(string $ip, int $port, string $serviceName, array $option
* 'namespaceId' => '',
* 'weight' => 0.99,
* 'metadata' => '', // json
* 'enabled' => false,
* 'ephemeral' => false,
* 'enabled' => 'false',
* 'ephemeral' => 'false',
* ]
* @return bool|PromiseInterface
* @throws GuzzleException
Expand Down Expand Up @@ -284,8 +284,8 @@ public function updateAsync(string $ip, int $port, string $serviceName, array $o
* 'namespaceId' => '',
* 'weight' => 0.99,
* 'metadata' => '', // json
* 'enabled' => false,
* 'ephemeral' => false,
* 'enabled' => 'false',
* 'ephemeral' => 'false',
* ]
* @param callable|null $success = function(\Workerman\Http\Response $response){}
* @param callable|null $error = function(\Exception $exception){}
Expand Down
4 changes: 2 additions & 2 deletions src/config/plugin/workbunny/webman-nacos/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
[
'groupName' => 'DEFAULT_GROUP',
'namespaceId' => '',
'enabled' => true,
'ephemeral' => 'false'
'enabled' => 'true',
'ephemeral' => 'false'
],
],
# 以下可以新增多个数组
Expand Down

0 comments on commit 577f0e0

Please sign in to comment.