维护数据根据发送端加锁
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2024-12-30 09:01:12 +08:00
parent b12079f8d9
commit aff1f5b599
1 changed files with 17 additions and 8 deletions

View File

@ -126,16 +126,25 @@ namespace IRaCIS.Core.SCP.Service
public async Task OnReceiveAssociationReleaseRequestAsync()
{
await DataMaintenanceAsaync();
var _distributedLockProvider = _serviceProvider.GetService<IDistributedLockProvider>();
//记录监控
var @lock = _distributedLockProvider.CreateLock($"{_upload.CallingAE}");
var _SCPImageUploadRepository = _serviceProvider.GetService<IRepository<SCPImageUpload>>();
using (await @lock.AcquireAsync())
{
_upload.EndTime = DateTime.Now;
_upload.StudyCount = _SCPStudyIdList.Count;
await DataMaintenanceAsaync();
await _SCPImageUploadRepository.AddAsync(_upload,true);
//记录监控
var _SCPImageUploadRepository = _serviceProvider.GetService<IRepository<SCPImageUpload>>();
_upload.EndTime = DateTime.Now;
_upload.StudyCount = _SCPStudyIdList.Count;
await _SCPImageUploadRepository.AddAsync(_upload, true);
}
await SendAssociationReleaseResponseAsync();
}
@ -263,7 +272,7 @@ namespace IRaCIS.Core.SCP.Service
{
try
{
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE,fileSize);
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
if (!_SCPStudyIdList.Contains(scpStudyId))
{
@ -315,7 +324,7 @@ namespace IRaCIS.Core.SCP.Service
//监控信息设置
_upload.FileCount++;
_upload.FileSize= _upload.FileSize+ fileSize;
_upload.FileSize = _upload.FileSize + fileSize;
return new DicomCStoreResponse(request, DicomStatus.Success);
}