Fix style

This commit is contained in:
Pavel Kruglov 2021-02-01 20:14:53 +03:00
parent 7d9eb966f0
commit f5ad1281f7
2 changed files with 11 additions and 6 deletions

View File

@ -92,8 +92,8 @@ void Connection::connect(const ConnectionTimeouts & timeouts)
void Connection::disconnect()
{
LOG_DEBUG(log_wrapper.get(), "disconnect");
LOG_DEBUG(log_wrapper.get(), "disconnect");
maybe_compressed_out = nullptr;
in = nullptr;
last_input_packet_type.reset();

View File

@ -426,7 +426,8 @@ void GetHedgedConnections::setBestUsableReplica(ReplicaStatePtr & replica)
std::remove_if(
indexes.begin(),
indexes.end(),
[&](int i) {
[&](int i)
{
return try_get_connections[i].result.entry.isNull() || !try_get_connections[i].result.is_usable ||
indexes_in_process.find(i) != indexes_in_process.end() || ready_indexes.find(i) != ready_indexes.end();
}),
@ -439,9 +440,13 @@ void GetHedgedConnections::setBestUsableReplica(ReplicaStatePtr & replica)
}
/// Sort replicas by staleness
std::stable_sort(indexes.begin(), indexes.end(), [&](size_t lhs, size_t rhs) {
return try_get_connections[lhs].result.staleness < try_get_connections[rhs].result.staleness;
});
std::stable_sort(
indexes.begin(),
indexes.end(),
[&](size_t lhs, size_t rhs)
{
return try_get_connections[lhs].result.staleness < try_get_connections[rhs].result.staleness;
});
replica->index = indexes[0];
replica->connection = &*try_get_connections[indexes[0]].result.entry;