diff options
author | dgolear <dgolear@yandex-team.com> | 2023-12-05 11:14:11 +0300 |
---|---|---|
committer | dgolear <dgolear@yandex-team.com> | 2023-12-05 12:37:32 +0300 |
commit | 7b2103d4721f993008eef0733e217ed1f5a427a2 (patch) | |
tree | 8e700170909dc8931aee4767df86e9ad1194bc46 | |
parent | 96458ea3c773a8a3edb707f73db0cdedbfcfad90 (diff) | |
download | ydb-7b2103d4721f993008eef0733e217ed1f5a427a2.tar.gz |
YT: Limit count in viable peer registry
-rw-r--r-- | yt/yt/core/rpc/viable_peer_registry.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/yt/yt/core/rpc/viable_peer_registry.cpp b/yt/yt/core/rpc/viable_peer_registry.cpp index 5e9e0e5d22..118e20efa0 100644 --- a/yt/yt/core/rpc/viable_peer_registry.cpp +++ b/yt/yt/core/rpc/viable_peer_registry.cpp @@ -213,6 +213,8 @@ public: static THashSet<int> GetRandomIndexes(int max, int count = 1) { THashSet<int> result; + count = std::min(count, max); + result.reserve(count); while (std::ssize(result) < count) { result.insert(static_cast<int>(RandomNumber<unsigned int>(max))); } |