Skip to content

Commit 508551c

Browse files
Added logger
1 parent 2e3c87f commit 508551c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Ydb.Sdk/src/Ado/Session/ImplicitSessionSource.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal sealed class ImplicitSessionSource : ISessionSource
77
private const int DisposeTimeoutSeconds = 10;
88

99
private readonly IDriver _driver;
10+
private readonly ILogger _logger;
1011
private readonly TaskCompletionSource _drainedTcs = new(TaskCreationOptions.RunContinuationsAsynchronously);
1112

1213
private int _isDisposed;
@@ -15,6 +16,7 @@ internal sealed class ImplicitSessionSource : ISessionSource
1516
internal ImplicitSessionSource(IDriver driver, ILoggerFactory loggerFactory)
1617
{
1718
_driver = driver;
19+
_logger = loggerFactory.CreateLogger<ImplicitSessionSource>();
1820
}
1921

2022
public ValueTask<ISession> OpenSession(CancellationToken cancellationToken)
@@ -60,6 +62,8 @@ public async ValueTask DisposeAsync()
6062
}
6163
catch (TimeoutException)
6264
{
65+
_logger.LogCritical("Disposal timed out: Some implicit sessions are still active");
66+
6367
throw new YdbException("Timeout while disposing of the pool: some implicit sessions are still active. " +
6468
"This may indicate a connection leak or suspended operations.");
6569
}
@@ -69,9 +73,9 @@ public async ValueTask DisposeAsync()
6973
{
7074
await _driver.DisposeAsync();
7175
}
72-
catch (Exception)
76+
catch (Exception e)
7377
{
74-
// ignored
78+
_logger.LogError(e, "Failed to dispose the transport driver");
7579
}
7680
}
7781
}

0 commit comments

Comments
 (0)