diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index b6951ad65..b04b231a3 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -170,7 +170,8 @@ namespace IRaCIS.Core.SCP.Service await AddUploadLogAsync(); _releasedNormally = true; - + + Log.Logger.Information($"进入释放连接请求 {_releasedNormally}"); } await SendAssociationReleaseResponseAsync(); @@ -251,38 +252,26 @@ namespace IRaCIS.Core.SCP.Service { var _studyRepository = _serviceProvider.GetService>(); - /* nothing to do here */ - //奇怪的bug 上传的时候,用王捷修改的影像,会关闭,重新连接,导致检查id 丢失,然后状态不一致 - if (exception == null) + if (exception == null || _releasedNormally == false) { //客户端断网,恢复后,也是没有异常的,估计是超时走了关闭 - if (_releasedNormally == true) - { - //将检查设置为传输结束 - await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = false }); - } - else - { - await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = true }); - - //记录日志 - await AddUploadLogAsync(); - } - - } - else - { await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = true }); //记录日志 await AddUploadLogAsync(); } + else + { + //将检查设置为传输结束 + await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true, IsUploadFaild = false }); + } + await _studyRepository.SaveChangesAndClearAllTrackingAsync(); - Log.Logger.Warning($"连接关闭 {exception?.Message} {exception?.InnerException?.Message}"); + Log.Logger.Warning($"连接关闭 {_releasedNormally} {exception?.Message} {exception?.InnerException?.Message}"); }