empiredan commented on code in PR #1902:
URL:
https://github.com/apache/incubator-pegasus/pull/1902#discussion_r1482504187
##########
src/runtime/rpc/dns_resolver.cpp:
##########
@@ -141,4 +141,6 @@ rpc_address dns_resolver::resolve_address(const host_port
&hp)
}
}
+dns_resolver::~dns_resolver() { _dns_cache.clear(); }
Review Comment:
`_dns_cache` would be released automatically at the destruction.
##########
src/runtime/test/host_port_test.cpp:
##########
@@ -230,10 +230,9 @@ TEST(host_port_test, transfer_rpc_address)
TEST(host_port_test, dns_resolver)
{
- dns_resolver resolver;
{
host_port hp("localhost", 8080);
- auto addr = resolver.resolve_address(hp);
+ auto addr = dns_resolver::instance().resolve_address(hp);
Review Comment:
```suggestion
const auto &addr = dns_resolver::instance().resolve_address(hp);
```
##########
src/runtime/test/host_port_test.cpp:
##########
@@ -248,7 +247,7 @@ TEST(host_port_test, dns_resolver)
host_port hp2("localhost", 8081);
g_hp->set_leader(hp2);
- auto addr_grp = resolver.resolve_address(hp_grp);
+ auto addr_grp = dns_resolver::instance().resolve_address(hp_grp);
auto g_addr = addr_grp.group_address();
Review Comment:
`rpc_group_address::count()` could also be declared as `const`:
```suggestion
const auto * const g_addr = addr_grp.group_address();
```
##########
src/runtime/test/host_port_test.cpp:
##########
@@ -248,7 +247,7 @@ TEST(host_port_test, dns_resolver)
host_port hp2("localhost", 8081);
g_hp->set_leader(hp2);
- auto addr_grp = resolver.resolve_address(hp_grp);
+ auto addr_grp = dns_resolver::instance().resolve_address(hp_grp);
Review Comment:
```suggestion
const auto &addr_grp =
dns_resolver::instance().resolve_address(hp_grp);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]