diff options
| author | Daniil Cherednik <[email protected]> | 2023-03-31 10:54:08 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2023-03-31 12:28:07 +0300 |
| commit | fc1cffcfa7f0497a1f97b384a24bcbf23362f3be (patch) | |
| tree | c15f7ab5b9e9b20fd0ef8fc07d598d28e8b32004 /library/cpp/actors/core/actorsystem.h | |
| parent | 8a749596d40e91c896a1907afcd108d9221fbde1 (diff) | |
Ydb stable 23-1-1923.1.19
x-stable-origin-commit: c5d5a396e89d0a72e0267a55e93d8404d4fb54fe
Diffstat (limited to 'library/cpp/actors/core/actorsystem.h')
| -rw-r--r-- | library/cpp/actors/core/actorsystem.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/library/cpp/actors/core/actorsystem.h b/library/cpp/actors/core/actorsystem.h index 8051f5ee573..cd2cfda1bbb 100644 --- a/library/cpp/actors/core/actorsystem.h +++ b/library/cpp/actors/core/actorsystem.h @@ -122,7 +122,21 @@ namespace NActors { } ui32 GetThreads(ui32 poolId) const { - return Executors ? Executors[poolId]->GetThreads() : CpuManager.GetThreads(poolId); + auto result = GetThreadsOptional(poolId); + Y_VERIFY(result, "undefined pool id: %" PRIu32, (ui32)poolId); + return *result; + } + + std::optional<ui32> GetThreadsOptional(const ui32 poolId) const { + if (Y_LIKELY(Executors)) { + if (Y_LIKELY(poolId < ExecutorsCount)) { + return Executors[poolId]->GetDefaultThreadCount(); + } else { + return {}; + } + } else { + return CpuManager.GetThreadsOptional(poolId); + } } }; |
