@@ -145,9 +145,21 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
await client.AddRequestAsync(new DicomCEchoRequest());
|
||||
|
||||
await client.SendAsync();
|
||||
// 创建一个超时任务,设置超时时间为1秒
|
||||
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(3));
|
||||
|
||||
// 发送 DICOM 请求
|
||||
var sendTask = client.SendAsync();
|
||||
|
||||
// 等待任务完成,若超时任务先完成则抛出超时异常
|
||||
if (await Task.WhenAny(sendTask, timeoutTask) == timeoutTask)
|
||||
{
|
||||
throw new TimeoutException("DICOM 请求超时。");
|
||||
}
|
||||
|
||||
|
||||
find.IsTestOK = true;
|
||||
|
||||
await _dicomAERepository.SaveChangesAsync();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user