mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-13 07:01:37 +00:00
Handle cancellation token disposal with error handling in ChatComponent
This commit is contained in:
parent
91a302be41
commit
a1106d4c40
@ -933,10 +933,17 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
if (this.cancellationTokenSource is not null)
|
if (this.cancellationTokenSource is not null)
|
||||||
{
|
{
|
||||||
if(!this.cancellationTokenSource.IsCancellationRequested)
|
try
|
||||||
await this.cancellationTokenSource.CancelAsync();
|
{
|
||||||
|
if(!this.cancellationTokenSource.IsCancellationRequested)
|
||||||
|
await this.cancellationTokenSource.CancelAsync();
|
||||||
|
|
||||||
this.cancellationTokenSource.Dispose();
|
this.cancellationTokenSource.Dispose();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user