Skip to content

ETCD 与 Discovery 分离#52

Open
yousongyang wants to merge 10 commits into
owent:mainfrom
yousongyang:main
Open

ETCD 与 Discovery 分离#52
yousongyang wants to merge 10 commits into
owent:mainfrom
yousongyang:main

Conversation

@yousongyang

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 20, 2026 06:36

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/etcd_module.cpp:255

Comment thread src/atframe/modules/etcd_module.cpp

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/etcd_module.cpp:137

Comment thread src/atframe/modules/etcd_module.cpp
@owent

owent commented May 20, 2026

Copy link
Copy Markdown
Owner

AI Code Review

Updated: 2026-06-11 05:10:57 UTC | Commit: c9bb455

AI Code Review Summary

etcd_module 拆分及多context支持代码审查

Target: ETCD 与 Discovery 分离
Author: @yousongyang
Branch: main
Reviewers: @yousongyang


审查总结

本次PR将 etcd_module 拆分为 etcd_module(纯etcd集群包装)和 service_discovery_module(继承自 module_impl 的服务发现模块),并引入多context支持(primary + external discovery)。整体架构清晰,但引入了3个与多context生命周期和正确性相关的问题。

发现的问题

严重程度 文件 问题
high src/atframe/modules/service_discovery_module.cpp update_internal_watcher_event 在处理 local_cache_by_id != local_cache_by_name 时,kDelete和kPut路径都会误删来自不同context的节点。kDelete的外层OR条件使不匹配的cache也被删除;kPut在has_event后无条件移除两个cache,未再校验context_addr。
medium src/atframe/modules/service_discovery_module.cpp tick() 中调用 init_service_discovery_keepalives_watchers(..., false)忽略返回值,无论初始化成败都将 discovery_keepalives_watchers_inited_ 置为true,导致失败后无法在下一次tick重试。
medium include/atframe/modules/service_discovery_module.h service_discovery_cluster_context 未声明析构函数。若实例在未调用stop()的情况下被销毁(如测试中的临时context),etcd_cluster中残留的watcher/keepalive引用无法被清理,存在资源泄漏或use-after-free风险。

其他观察

  • Proto字段重编号(atapp_etcd_keepaliveatapp_etcd_watcher)对文本配置无影响,但会破坏已有的二进制序列化数据。鉴于配置通常以YAML/JSON形式存在,此处未作为问题上报。
  • get_configure_path() 移除了 const 限定符,属于已知的API变更,项目中所有调用点已同步更新。
  • 新增的 curl_multi_guard_type 静态初始化方式相比原代码对线程安全有一定改善。

Problems (3)

# Severity Category Location Message
0 HIGH correctness src/atframe/modules/service_discovery_module.cpp:1562 多context场景下,kDelete事件可能误删不同context的节点。外层条件使用OR判断"任一cache的context_addr匹配",但内层对每个cache的删除操作不再检查context_addr。若local_cache_by_name匹配当前context而local_cache_by_id来自另一context,则后者也会被错误删除(仅打印warning后仍执行remove_node)。同理,kPut分支中has_event为true后,对local_cache_by_id和local_cache_by_name的移除也未再次校验context_addr,可能导致跨context误删。
1 MEDIUM correctness src/atframe/modules/service_discovery_module.cpp:314 tick()中调用init_service_discovery_keepalives_watchers(..., false)后,无论初始化是否成功都会将discovery_keepalives_watchers_inited_置为true。如果keepalive或watcher创建失败(如内存分配失败返回EN_ATBUS_ERR_MALLOC),标志位仍被置位,导致后续tick不再重试,discovery处于半初始化状态且无法自动恢复。
2 MEDIUM memory/resource safety include/atframe/modules/service_discovery_module.h:120 service_discovery_cluster_context未声明析构函数。该类通过data_持有watcher和keepalive对象,并在etcd_module_的etcd_cluster中注册。若实例被销毁前未显式调用stop()(如测试代码中临时创建的context超出作用域),reset_internal_watchers_and_keepalives()不会被调用,etcd_cluster中可能残留对已销毁context的watcher/keepalive引用,导致资源泄漏或潜在的use-after-free(取决于etcd_cluster内部是持有shared_ptr还是裸指针)。

Code reference: src/atframe/modules/service_discovery_module.cpp:1562

      has_event = true;
    }
  } else {
    if (node_action_t::kDelete == node.action) {
      // 有一个节点 context 匹配则都删除

Code reference: src/atframe/modules/service_discovery_module.cpp:314

    if (!cluster_context_->get_etcd_module().is_cluster_closing()) {
      // 不是正在关闭状态
      if (discovery_enabled_ && !discovery_keepalives_watchers_inited) {
        init_service_discovery_keepalives_watchers(cluster_context_, false);
        discovery_keepalives_watchers_inited_ = true;

Code reference: include/atframe/modules/service_discovery_module.h:120

  struct service_discovery_cluster_context_data;

  class service_discovery_cluster_context {
   public:
    friend class service_discovery_module;

  • Powered by AICodeReviewer*

Open Issues (3)

1. [HIGH] correctnesssrc/atframe/modules/service_discovery_module.cpp:1562 (new in c9bb455)
2. [MEDIUM] correctnesssrc/atframe/modules/service_discovery_module.cpp:314 (new in c9bb455)
3. [MEDIUM] memory/resource safetyinclude/atframe/modules/service_discovery_module.h:120 (new in c9bb455)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR separates the etcd client responsibilities from service discovery by introducing a new service_discovery_module that owns discovery/topology keepalives + watchers while refactoring etcd_module into a lower-level etcd cluster wrapper. The change also migrates configuration from atapp.etcd to atapp.service_discovery_etcd and updates unit tests accordingly.

Changes:

  • Add service_discovery_module and wire it into atapp::app as the internal discovery module.
  • Refactor etcd_module API/surface (no longer an app module) and adapt discovery nodes to carry a context_ptr.
  • Update tests/config fixtures to use service_discovery_etcd and the new discovery APIs.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/CMakeLists.txt Adds new service discovery module sources/headers to the build.
src/atframe/modules/service_discovery_module.cpp New implementation: manages etcd watchers/keepalives and updates in-memory discovery/topology sets.
include/atframe/modules/service_discovery_module.h New public API for service discovery module (callbacks, paths, snapshots, etc.).
include/atframe/modules/etcd_module.h Refactors etcd_module into a non-module etcd wrapper used by service discovery.
src/atframe/atapp.cpp Replaces internal etcd module with service discovery module; adds curl-multi setup; updates discovery send paths and CLI discovery listing.
include/atframe/atapp.h Updates app API to expose get_service_discovery_module() and adds curl-multi state.
src/atframe/connectors/atapp_connector_atbus.cpp Routes topology refresh signaling through service discovery module.
include/atframe/atapp_conf.proto Renames config field to service_discovery_etcd.
src/atframe/etcdcli/etcd_discovery.cpp Adds context_ptr_ tracking and updates copy/version APIs.
include/atframe/etcdcli/etcd_discovery.h Updates discovery node APIs to accept/store context_ptr.
test/case/atapp_upstream_forward_test.cpp Switches tests to use service discovery module/global discovery and new copy_from signature.
test/case/atapp_topology_change_test.cpp Same migration for topology change tests.
test/case/atapp_message_test.cpp Same migration for message tests.
test/case/atapp_etcd_module_unit_test.cpp Updates topology storage tests to use service discovery module storage types.
test/case/atapp_etcd_module_test.cpp Migrates etcd/discovery behavior tests to the new module APIs.
test/case/atapp_etcd_cluster_test.cpp Uses service discovery module’s raw etcd ctx for cluster tests.
test/case/atapp_error_recovery_test.cpp Migrates recovery tests to service discovery module/global discovery.
test/case/atapp_downstream_send_test.cpp Migrates downstream send tests to service discovery module/global discovery.
test/case/atapp_discovery_test.cpp Updates discovery node version/copy APIs with the new parameter.
test/case/atapp_discovery_reconnect_test.cpp Migrates reconnect tests to service discovery module/global discovery.
test/case/atapp_direct_connect_test.cpp Adjusts direct-connect behavior expectations + migrates discovery injection/module usage.
test/case/atapp_test_etcd.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_node1.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_node2.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_module.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_module_node1.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_module_node2.yaml Renames config section to service_discovery_etcd.
test/case/atapp_test_etcd_module_node3.yaml Adds node3 config using service_discovery_etcd.
test/case/atapp_configure_loader_test.yaml Renames config section to service_discovery_etcd.
test/case/atapp_configure_loader_test.conf Renames config keys to service_discovery_etcd.*.
test/case/atapp_configure_loader_test.env.txt Renames env vars to ATAPP_SERVICE_DISCOVERY_ETCD_*.
test/case/atapp_configure_loader_test.cpp Updates loader tests to parse/check atapp.service_discovery_etcd.
test/case/atapp_configure_expression_test.yaml Renames config section to service_discovery_etcd.
test/case/atapp_configure_expression_test.conf Renames config keys to service_discovery_etcd.*.
test/case/atapp_configure_expression_test.env.txt Renames env vars to ATAPP_SERVICE_DISCOVERY_ETCD_*.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp Outdated

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/atapp.cpp:4108

Comment thread src/atframe/atapp.cpp

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/service_discovery_module.cpp:246

Comment thread src/atframe/modules/service_discovery_module.cpp

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/etcd_module.cpp:257

Comment thread src/atframe/modules/etcd_module.cpp Outdated

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/etcd_module.cpp:272

Comment thread src/atframe/modules/etcd_module.cpp

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/service_discovery_module.cpp:246

Comment thread src/atframe/modules/service_discovery_module.cpp

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/service_discovery_module.cpp:232

Comment thread src/atframe/modules/service_discovery_module.cpp Outdated

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for include/atframe/modules/service_discovery_module.h:42

Comment thread include/atframe/modules/service_discovery_module.h Outdated
Comment thread src/atframe/modules/service_discovery_module.cpp Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.

Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
Comment thread src/atframe/atapp.cpp
Comment thread include/atframe/modules/service_discovery_module.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 5 comments.

Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/etcdcli/etcd_discovery.cpp Outdated
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread include/atframe/modules/service_discovery_module.h Outdated

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/service_discovery_module.cpp:237

Comment thread src/atframe/modules/service_discovery_module.cpp Outdated

@owent owent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AICR problem for src/atframe/modules/service_discovery_module.cpp:350

Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
Copilot AI review requested due to automatic review settings May 21, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.

Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/etcdcli/etcd_discovery.cpp Outdated
Comment thread include/atframe/atapp_conf.proto Outdated
Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
Comment thread src/atframe/modules/etcd_module.cpp Fixed
Comment thread src/atframe/modules/service_discovery_module.cpp
Copilot AI review requested due to automatic review settings June 11, 2026 03:48
Comment thread src/atframe/modules/service_discovery_module.cpp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.

Comment thread include/atframe/atapp_conf.proto
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Copilot AI review requested due to automatic review settings June 11, 2026 03:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 8 comments.

Comment thread include/atframe/atapp_conf.proto
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread include/atframe/modules/etcd_module.h
Copilot AI review requested due to automatic review settings June 11, 2026 03:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 10 comments.

Comment thread include/atframe/atapp_conf.proto
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp
Copilot AI review requested due to automatic review settings June 11, 2026 03:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 9 comments.

Comment thread include/atframe/atapp_conf.proto
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread src/atframe/atapp.cpp
Comment thread src/atframe/atapp.cpp Outdated
Comment thread include/atframe/modules/service_discovery_module.h
Copilot AI review requested due to automatic review settings June 11, 2026 04:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.

Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/modules/service_discovery_module.cpp
Comment thread src/atframe/atapp.cpp Outdated
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread test/case/atapp_test_etcd_module_multi_context_node3.yaml
Comment thread src/atframe/modules/etcd_module.cpp Outdated
Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
Comment thread src/atframe/modules/service_discovery_module.cpp Outdated
@owent

owent commented Jun 16, 2026

Copy link
Copy Markdown
Owner

TODO: 如果现在要支持多个cluster,状态类接口也需要支持external cluster,比如:

  • has_discovery_snapshot
  • has_topology_snapshot

TODO: reload新增和减少 external_cluster_contexts_

  • 注意回收lease和错误重试流程

TODO: 索引优化

  • _collect_old_nodes和_collect_old_topology_peers可以只采集对应的service_discovery_cluster_context的数据
  • 加一层按 service_discovery_cluster_context 的索引?避免某些接口全量扫描筛选

可以先加个TODO,下一期再实现(注意要有单元测试)。

Copilot AI review requested due to automatic review settings June 17, 2026 02:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 10 comments.

Comment on lines +309 to +340
bool discovery_keepalives_watchers_inited = discovery_keepalives_watchers_inited_;
{
cluster_context_->tick();
if (!cluster_context_->get_etcd_module().is_cluster_closing()) {
// 不是正在关闭状态
if (discovery_enabled_ && !discovery_keepalives_watchers_inited) {
init_service_discovery_keepalives_watchers(cluster_context_, false);
discovery_keepalives_watchers_inited_ = true;
}
if (!discovery_enabled_ && discovery_keepalives_watchers_inited) {
// 不是正在关闭状态但不需要 discovery 了
cluster_context_->reset_internal_watchers_and_keepalives();
discovery_keepalives_watchers_inited_ = false;
}
}
}

for (const auto &external_cluster_context : external_cluster_contexts_) {
external_cluster_context->tick();
if (!external_cluster_context->get_etcd_module().is_cluster_closing()) {
// 不是正在关闭状态
if (discovery_enabled_ && !discovery_keepalives_watchers_inited) {
init_service_discovery_keepalives_watchers(external_cluster_context, false);
discovery_keepalives_watchers_inited_ = true;
}
if (!discovery_enabled_ && discovery_keepalives_watchers_inited) {
// 不是正在关闭状态但不需要 discovery 了
external_cluster_context->reset_internal_watchers_and_keepalives();
discovery_keepalives_watchers_inited_ = false;
}
}
}
Comment on lines +3 to +5
id: 0x00000802
id_mask: 8.8.8.8
name: "etcd-test-node2"
type_name: "etcd-multi-test"

bus:
listen: "ipv4://127.0.0.1:22303"
Comment on lines +67 to +68
file: "../log/etcd-test-node2.%N.log"
writing_alias: "../log/etcd-test-node2.log"
Comment on lines +6 to +9
atapp:
id: 0x00000901
id_mask: 8.8.8.8
name: "etcd-ext-disc-node1"
type_name: "etcd-ext-disc-test"

bus:
listen: "ipv4://127.0.0.1:22401"
Comment on lines +94 to +95
file: "../log/etcd-ext-disc-node2a.%N.log"
writing_alias: "../log/etcd-ext-disc-node2a.log"
Comment thread src/atframe/atapp.cpp
Comment on lines +4865 to +4872
int app::command_handler_disable_discovery(atfw::util::cli::callback_param params) {
if (!internal_module_service_discovery_) {
const char *msg = "Service discovery module not initialized, skip command.";
FWLOGERROR("{}", msg);
add_custom_command_rsp(params, msg);
} else if (internal_module_etcd_->is_etcd_enabled()) {
internal_module_etcd_->disable_etcd();
const char *msg = "Etcd context is disabled now.";
} else if (internal_module_service_discovery_->is_discovery_enabled()) {
internal_module_service_discovery_->disable_discovery();
const char *msg = "Service discovery context is disabled now.";
Comment thread src/atframe/atapp.cpp
Comment on lines +4883 to +4889
int app::command_handler_enable_discovery(atfw::util::cli::callback_param params) {
if (!internal_module_service_discovery_) {
const char *msg = "Service discovery module not initialized, skip command.";
FWLOGERROR("{}", msg);
add_custom_command_rsp(params, msg);
} else if (internal_module_etcd_->is_etcd_enabled()) {
const char *msg = "Etcd context is already enabled, skip command.";
} else if (internal_module_service_discovery_->is_discovery_enabled()) {
const char *msg = "Service discovery context is already enabled, skip command.";
Comment thread src/atframe/atapp.cpp
const char *msg = "Etcd context is enabled now.";
internal_module_service_discovery_->enable_discovery();
if (internal_module_service_discovery_->is_discovery_enabled()) {
const char *msg = "Service discovery context is enabled now.";
Copilot AI review requested due to automatic review settings June 17, 2026 02:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Comment on lines +302 to +324
LIBATAPP_MACRO_API int service_discovery_module::tick() {
// Slow down the tick interval of etcd module, it require http request which is very slow compared to atbus
if (tick_next_timepoint_ >= get_app()->get_last_tick_time()) {
return 0;
}
tick_next_timepoint_ = get_app()->get_last_tick_time() + tick_interval_;

bool discovery_keepalives_watchers_inited = discovery_keepalives_watchers_inited_;
{
cluster_context_->tick();
if (!cluster_context_->get_etcd_module().is_cluster_closing()) {
// 不是正在关闭状态
if (discovery_enabled_ && !discovery_keepalives_watchers_inited) {
init_service_discovery_keepalives_watchers(cluster_context_, false);
discovery_keepalives_watchers_inited_ = true;
}
if (!discovery_enabled_ && discovery_keepalives_watchers_inited) {
// 不是正在关闭状态但不需要 discovery 了
cluster_context_->reset_internal_watchers_and_keepalives();
discovery_keepalives_watchers_inited_ = false;
}
}
}
Comment on lines +411 to 415
bool enabled = 1 [(atapp.protocol.CONFIGURE) = { default_value: "true" }];
google.protobuf.Duration timeout = 101 [(atapp.protocol.CONFIGURE) = { default_value: "31s" }];
google.protobuf.Duration ttl = 102 [(atapp.protocol.CONFIGURE) = { default_value: "10s" }];
google.protobuf.Duration retry_interval = 103 [(atapp.protocol.CONFIGURE) = { default_value: "3s" }];
}
Comment on lines +3 to +5
id: 0x00000802
id_mask: 8.8.8.8
name: "etcd-test-node2"
type_name: "etcd-multi-test"

bus:
listen: "ipv4://127.0.0.1:22303"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants