Use at most 7 client threads on OpenBSD to stay within default limit of 128 file descriptors.

This commit is contained in:
levlam 2021-12-24 14:11:36 +03:00
parent d6a9c509ab
commit f7588582cd
2 changed files with 6 additions and 2 deletions

View File

@ -429,7 +429,11 @@ class MultiImplPool {
if (impls_.empty()) {
init_openssl_threads();
impls_.resize(clamp(thread::hardware_concurrency(), 8u, 20u) * 5 / 4);
auto max_client_threads = clamp(thread::hardware_concurrency(), 8u, 20u) * 5 / 4;
#if TD_OPENBSD
max_client_threads = td::min(max_client_threads, 7u);
#endif
impls_.resize(max_client_threads);
CHECK(impls_.size() * (1 + MultiImpl::ADDITIONAL_THREAD_COUNT + 1 /* IOCP */) < 128);
net_query_stats_ = std::make_shared<NetQueryStats>();

View File

@ -868,7 +868,7 @@ TEST(Client, Simple) {
}
TEST(Client, SimpleMulti) {
std::vector<td::Client> clients(40);
std::vector<td::Client> clients(7);
//for (auto &client : clients) {
//client.execute({1, td::td_api::make_object<td::td_api::setLogTagVerbosityLevel>("td_requests", 1)});
//}