diff --git a/src/Ydb.Sdk/src/Services/Table/SessionPool.cs b/src/Ydb.Sdk/src/Services/Table/SessionPool.cs index a014eb9a..4d297ab0 100644 --- a/src/Ydb.Sdk/src/Services/Table/SessionPool.cs +++ b/src/Ydb.Sdk/src/Services/Table/SessionPool.cs @@ -91,6 +91,20 @@ public SessionPool(Driver driver, SessionPoolConfig config) } public async Task GetSession() + { + const int maxAttempts = 100; + + GetSessionResponse getSessionResponse = null!; + for (var attempt = 0; attempt < maxAttempts; attempt++) + { + getSessionResponse = await GetSessionAttempt(); + } + + _logger.LogError($"Failed to get session from pool or create it (attempts: {maxAttempts})"); + return getSessionResponse; + } + + private async Task GetSessionAttempt() { lock (_lock) {