Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Apr 17, 2024
1 parent b08f435 commit 09ec2a3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion include/atframe/modules/etcd_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class etcd_module : public ::atapp::module_impl {
LIBATAPP_MACRO_API const ::atapp::etcd_cluster &get_raw_etcd_ctx() const;
LIBATAPP_MACRO_API ::atapp::etcd_cluster &get_raw_etcd_ctx();

LIBATAPP_MACRO_API const ::atapp::etcd_response_header & get_last_etcd_event_header() const;
LIBATAPP_MACRO_API const ::atapp::etcd_response_header &get_last_etcd_event_header() const;

LIBATAPP_MACRO_API const atapp::protocol::atapp_etcd &get_configure() const;
LIBATAPP_MACRO_API const std::string &get_configure_path() const;
Expand Down
12 changes: 6 additions & 6 deletions src/atframe/atapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,9 @@ LIBATAPP_MACRO_API util::cli::cmd_option::ptr_type app::get_option_manager() {
LIBATAPP_MACRO_API bool app::is_current_upgrade_mode() const noexcept { return conf_.upgrade_mode; }

LIBATAPP_MACRO_API util::network::http_request::curl_m_bind_ptr_t app::get_shared_curl_multi_context() const noexcept {
UTIL_LIKELY_IF(internal_module_etcd_) { return internal_module_etcd_->get_shared_curl_multi_context(); }
UTIL_LIKELY_IF (internal_module_etcd_) {
return internal_module_etcd_->get_shared_curl_multi_context();
}

return nullptr;
}
Expand Down Expand Up @@ -3468,12 +3470,11 @@ bool app::setup_timeout_timer(const ATBUS_MACRO_PROTOBUF_NAMESPACE_ID::Duration

int res = uv_timer_start(&timer->timer, ev_stop_timeout,
details::chrono_to_libuv_duration(duration, ATAPP_DEFAULT_STOP_TIMEOUT), 0);
UTIL_LIKELY_IF(0 == res) {
UTIL_LIKELY_IF (0 == res) {
tick_timer_.timeout_timer = timer;

return true;
}
else {
} else {
FWLOGERROR("setup timeout timer failed, res: {}", res);
set_flag(flag_t::TIMEOUT, false);

Expand Down Expand Up @@ -3641,8 +3642,7 @@ LIBATAPP_MACRO_API void app::split_ids_by_string(const char *in, std::vector<app

out.push_back(::util::string::to_int<app_id_t>(in));

for (; nullptr != in && *in && '.' != *in; ++in)
;
for (; nullptr != in && *in && '.' != *in; ++in);
// skip dot and ready to next segment
if (nullptr != in && *in && '.' == *in) {
++in;
Expand Down
5 changes: 2 additions & 3 deletions src/atframe/connectors/atapp_connector_loopback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,9 @@ LIBATAPP_MACRO_API int32_t atapp_connector_loopback::process(
}

++ret;
UTIL_LIKELY_IF(pending_message_size_ >= pending_msg.data.size()) {
UTIL_LIKELY_IF (pending_message_size_ >= pending_msg.data.size()) {
pending_message_size_ -= pending_msg.data.size();
}
else {
} else {
pending_message_size_ = 0;
}
#if defined(LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST) && LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST
Expand Down
10 changes: 6 additions & 4 deletions src/atframe/connectors/atapp_endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ LIBATAPP_MACRO_API int32_t atapp_endpoint::retry_pending_messages(const util::ti

++ret;

UTIL_LIKELY_IF(pending_message_size_ >= msg.data.size()) { pending_message_size_ -= msg.data.size(); }
else {
UTIL_LIKELY_IF (pending_message_size_ >= msg.data.size()) {
pending_message_size_ -= msg.data.size();
} else {
pending_message_size_ = 0;
}
#if defined(LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST) && LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST
Expand Down Expand Up @@ -345,8 +346,9 @@ void atapp_endpoint::cancel_pending_messages() {
reinterpret_cast<const void *>(msg.data.data()), msg.data.size(),
msg.metadata.get());

UTIL_LIKELY_IF(pending_message_size_ >= msg.data.size()) { pending_message_size_ -= msg.data.size(); }
else {
UTIL_LIKELY_IF (pending_message_size_ >= msg.data.size()) {
pending_message_size_ -= msg.data.size();
} else {
pending_message_size_ = 0;
}
#if defined(LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST) && LIBATAPP_ENABLE_CUSTOM_COUNT_FOR_STD_LIST
Expand Down
16 changes: 12 additions & 4 deletions src/atframe/etcdcli/etcd_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_na
LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_consistent_hash(
const void *buf, size_t bufsz, const metadata_type *metadata) const {
index_cache_type *index_set = mutable_index_cache(metadata);
UTIL_UNLIKELY_IF(nullptr == index_set) { return nullptr; }
UTIL_UNLIKELY_IF (nullptr == index_set) {
return nullptr;
}

if (index_set->hashing_cache.empty()) {
rebuild_cache(*index_set, metadata);
Expand Down Expand Up @@ -527,7 +529,9 @@ LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_co
LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_random(
const metadata_type *metadata) const {
index_cache_type *index_set = mutable_index_cache(metadata);
UTIL_UNLIKELY_IF(nullptr == index_set) { return nullptr; }
UTIL_UNLIKELY_IF (nullptr == index_set) {
return nullptr;
}

if (index_set->round_robin_cache.empty()) {
rebuild_cache(*index_set, metadata);
Expand All @@ -546,7 +550,9 @@ LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_ra
LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_round_robin(
const metadata_type *metadata) const {
index_cache_type *index_set = mutable_index_cache(metadata);
UTIL_UNLIKELY_IF(nullptr == index_set) { return nullptr; }
UTIL_UNLIKELY_IF (nullptr == index_set) {
return nullptr;
}

if (index_set->round_robin_cache.empty()) {
rebuild_cache(*index_set, metadata);
Expand All @@ -569,7 +575,9 @@ LIBATAPP_MACRO_API etcd_discovery_node::ptr_t etcd_discovery_set::get_node_by_ro
LIBATAPP_MACRO_API const std::vector<etcd_discovery_node::ptr_t> &etcd_discovery_set::get_sorted_nodes(
const metadata_type *metadata) const {
index_cache_type *index_set = mutable_index_cache(metadata);
UTIL_UNLIKELY_IF(nullptr == index_set) { return get_empty_discovery_set(); }
UTIL_UNLIKELY_IF (nullptr == index_set) {
return get_empty_discovery_set();
}

if (index_set->round_robin_cache.empty()) {
rebuild_cache(*index_set, metadata);
Expand Down

0 comments on commit 09ec2a3

Please sign in to comment.