Skip to content

Commit 10a733a

Browse files
mpartipiloclaude
andcommitted
fix(export): mirror disposal fixes from #331
Port the same two BackupOperationBase / BackupClient fixes that landed in #331 to their export counterparts (which were copy-pasted from the backup pattern): - ExportOperationBase.DisposeInternal: drop the self-Wait. The method is called from RefreshStatusInternal which itself runs inside _backgroundRefreshTask, so Wait()ing on that task blocked it on its own completion. - ExportClient.CreateSync: wrap the operation in `await using` so it gets disposed on every exit path, not just success (where auto-dispose runs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c1e84e2 commit 10a733a

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/Weaviate.Client/ExportClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async Task<Export> CreateSync(
7070
)
7171
{
7272
await _client.EnsureVersion<ExportClient>();
73-
var operation = await Create(request, cancellationToken);
73+
await using var operation = await Create(request, cancellationToken);
7474
return await operation.WaitForCompletion(timeout, cancellationToken);
7575
}
7676

src/Weaviate.Client/Models/ExportOperationBase.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,17 @@ protected virtual void Dispose(bool disposing)
163163
_disposed = true;
164164
}
165165

166+
/// <summary>
167+
/// Internal disposal called from the background refresh task itself when a terminal status
168+
/// is observed. Must NOT Wait() on _backgroundRefreshTask — that would block the very task
169+
/// executing this code on its own completion (bounded only by the Wait timeout). The task
170+
/// is already exiting because _cts has been canceled and _isCompleted is set, so just
171+
/// release the CTS.
172+
/// </summary>
166173
private void DisposeInternal()
167174
{
168175
if (_disposed)
169176
return;
170-
try
171-
{
172-
_backgroundRefreshTask.Wait(ExportClient.Config.PollInterval);
173-
}
174-
catch (Exception)
175-
{
176-
// Best-effort disposal
177-
}
178177
_cts.Dispose();
179178
_disposed = true;
180179
}

0 commit comments

Comments
 (0)