Skip to content

Commit

Permalink
fixed 已知的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Dec 8, 2023
1 parent 6c0e328 commit 77b79a5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Process/InstanceRegistrarProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,13 @@ public function __construct()
protected function _heartbeat(string $name): void
{
if (isset($this->instanceRegistrars[$name])) {
list($serviceName, $ip, $port, $option) = $this->instanceRegistrars[$name];
if (isset($option['ephemeral'])) {
$option['ephemeral'] = (is_string($option['ephemeral']) ? filter_var($option['ephemeral'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool) $option['ephemeral'] );
}
// 仅对非永久实例进行心跳
if ($option['ephemeral'] ?? false) {
$this->heartbeatTimers[$name] = Timer::add($this->heartbeat, function () use ($name) {
list($serviceName, $ip, $port, $option) = $this->instanceRegistrars[$name];
if (isset($option['ephemeral'])) {
$option['ephemeral'] = (is_string($option['ephemeral']) ? filter_var($option['ephemeral'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool) $option['ephemeral'] );
}
$this->heartbeatTimers[$name] = Timer::add($this->heartbeat, function () use ($name, $serviceName, $ip, $port, $option) {
try {
if(!$this->client->instance->beat(
$serviceName,
Expand Down

0 comments on commit 77b79a5

Please sign in to comment.