Skip to content

Commit 341068f

Browse files
committed
Merge fix
1 parent ac24245 commit 341068f

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/Ydb.Sdk/src/Services/Query/SessionPool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ private protected override Session CopySession(Session other)
153153
endpoint: other.Endpoint);
154154
}
155155

156-
private protected override void DeleteSession(string id)
156+
private protected override async Task DeleteSession(string id)
157157
{
158158
DetachSession(id);
159159

160-
_ = Client.DeleteSession(id, new DeleteSessionSettings
160+
await Client.DeleteSession(id, new DeleteSessionSettings
161161
{
162162
TransportTimeout = SessionBase.DeleteSessionTimeout
163163
});

src/Ydb.Sdk/src/Services/Sessions/SessionPoolBase.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ internal void ReturnSession(string id)
155155

156156
private protected abstract Task<GetSessionResponse<TSession>> CreateSession();
157157
private protected abstract TSession CopySession(TSession other);
158-
private protected abstract void DeleteSession(string id);
158+
private protected abstract Task DeleteSession(string id);
159159

160160
internal void InvalidateSession(string id)
161161
{
@@ -182,12 +182,16 @@ private void Dispose(bool disposing)
182182

183183
if (disposing)
184184
{
185+
var tasks = new Task[Sessions.Count];
186+
var i = 0;
185187
foreach (var state in Sessions.Values)
186188
{
187189
Logger.LogTrace($"Closing session on session pool dispose: {state.Session.Id}");
188190

189-
DeleteSession(state.Session.Id);
191+
var task = DeleteSession(state.Session.Id);
192+
tasks[i++] = task;
190193
}
194+
Task.WaitAll(tasks);
191195
}
192196

193197
Disposed = true;

src/Ydb.Sdk/src/Services/Table/Session.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected override void Dispose(bool disposing)
5353
{
5454
Logger.LogTrace($"Closing detached session on dispose: {Id}");
5555

56-
var client = new TableClient(Driver, new NoPool());
56+
var client = new TableClient(Driver, new NoPool<Session>());
5757
var task = client.DeleteSession(Id, new DeleteSessionSettings
5858
{
5959
TransportTimeout = DeleteSessionTimeout

src/Ydb.Sdk/src/Services/Table/SessionPool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ private async Task CheckSessions()
140140
}
141141
}
142142

143-
private protected override void DeleteSession(string id)
143+
private protected override async Task DeleteSession(string id)
144144
{
145-
_ = Client.DeleteSession(id, new DeleteSessionSettings
145+
await Client.DeleteSession(id, new DeleteSessionSettings
146146
{
147147
TransportTimeout = SessionBase.DeleteSessionTimeout
148148
});

0 commit comments

Comments
 (0)