Skip to content

Commit 8f4f0af

Browse files
Merge branch 'BeyondDimension:develop' into develop
2 parents f4ded78 + 6577ed9 commit 8f4f0af

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/BD.WTTS.Client.Plugins.Accelerator/Services/Mvvm/ProxyService.Operate.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ async Task<OperateProxyServiceResult> StopProxyServiceCoreAsync(bool isExit)
406406
if (!string.IsNullOrEmpty(proxyTokenCache))
407407
return proxyTokenCache;
408408

409+
using CancellationTokenSource cts = new();
410+
cts.CancelAfter(TimeSpan.FromSeconds(4.99D)); // 5 秒超时
409411
var resp = await IMicroServiceClient.Instance.Account
410-
.GenerateServerSideProxyToken();
412+
.GenerateServerSideProxyToken(cts.Token);
411413

412414
if (resp != null && !string.IsNullOrEmpty(resp.Content?.AccessToken))
413415
{
@@ -416,11 +418,14 @@ async Task<OperateProxyServiceResult> StopProxyServiceCoreAsync(bool isExit)
416418

417419
return proxyTokenCache;
418420
}
421+
catch (OperationCanceledException)
422+
{
423+
}
419424
catch (Exception ex)
420425
{
421426
ex.LogAndShowT();
422-
return null;
423427
}
428+
return null;
424429
}
425430

426431
/// <summary>

0 commit comments

Comments
 (0)