File tree Expand file tree Collapse file tree 7 files changed +8
-25
lines changed
tests/UnitTests/Common.Tests/Services Expand file tree Collapse file tree 7 files changed +8
-25
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,6 @@ public PayloadService(
135135
136136 if ( workflowInstance is null ) { return null ; }
137137
138- var t = await _workflowRepository . GetByWorkflowIdAsync ( workflowInstance . WorkflowId ) ;
139-
140138 return ( await _workflowRepository . GetByWorkflowIdAsync ( workflowInstance . WorkflowId ) ) ? . Workflow ? . DataRetentionDays ?? null ;
141139 }
142140
Original file line number Diff line number Diff line change 1919
2020namespace Monai . Deploy . WorkflowManager . Common . Contracts . Migrations
2121{
22- public class M004_Payload_expires : DocumentMigration < Payload >
22+ public class M004_Payload_Expires : DocumentMigration < Payload >
2323 {
24- public M004_Payload_expires ( ) : base ( "1.0.4" ) { }
24+ public M004_Payload_Expires ( ) : base ( "1.0.4" ) { }
2525
2626 public override void Up ( BsonDocument document )
2727 {
Original file line number Diff line number Diff line change 2020
2121namespace Monai . Deploy . WorkflowManager . Common . Contracts . Migrations
2222{
23- public class M004_WorkflowRevision_addDataRetension : DocumentMigration < WorkflowRevision >
23+ public class M004_WorkflowRevision_AddDataRetension : DocumentMigration < WorkflowRevision >
2424 {
25- public M004_WorkflowRevision_addDataRetension ( ) : base ( "1.0.1" ) { }
25+ public M004_WorkflowRevision_AddDataRetension ( ) : base ( "1.0.1" ) { }
2626
2727 public override void Up ( BsonDocument document )
2828 {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ private async Task EnsureIndex()
6666 var indexes = bsonDocuments . Select ( _ => _ . GetElement ( "name" ) . Value . ToString ( ) ) . ToList ( ) ;
6767
6868 // If index not present create it else skip.
69- if ( ! indexes . Any ( i => i is not null && i . Equals ( indexName ) ) )
69+ if ( ! indexes . Exists ( i => i is not null && i . Equals ( indexName ) ) )
7070 {
7171 await _payloadCollection . Indexes . CreateOneAsync ( model ) ;
7272 }
Original file line number Diff line number Diff line change @@ -206,20 +206,6 @@ public async Task<IList<WorkflowRevision>> GetWorkflowsForWorkflowRequestAsync(s
206206 ArgumentNullException . ThrowIfNullOrEmpty ( calledAeTitle , nameof ( calledAeTitle ) ) ;
207207 ArgumentNullException . ThrowIfNullOrEmpty ( callingAeTitle , nameof ( callingAeTitle ) ) ;
208208
209- var t = _workflowCollection
210- . Find ( x =>
211- x . Workflow != null &&
212- x . Workflow . InformaticsGateway != null &&
213- ( ( x . Workflow . InformaticsGateway . AeTitle == calledAeTitle &&
214- ( x . Workflow . InformaticsGateway . DataOrigins == null ||
215- x . Workflow . InformaticsGateway . DataOrigins . Length == 0 ) ) ||
216- x . Workflow . InformaticsGateway . AeTitle == calledAeTitle &&
217- x . Workflow . InformaticsGateway . DataOrigins != null &&
218- x . Workflow . InformaticsGateway . DataOrigins . Any ( d => d == callingAeTitle ) ) &&
219- x . Deleted == null ) ;
220-
221- var coll = t . ToList ( ) ;
222-
223209 var wfs = await _workflowCollection
224210 . Find ( x =>
225211 x . Workflow != null &&
@@ -233,7 +219,6 @@ public async Task<IList<WorkflowRevision>> GetWorkflowsForWorkflowRequestAsync(s
233219 x . Deleted == null )
234220 . ToListAsync ( ) ;
235221
236-
237222 return wfs ;
238223 }
239224
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public Worker(
5252 _publisherService = publisherService ?? throw new ArgumentNullException ( nameof ( publisherService ) ) ;
5353 _options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
5454 _payloadRepository = payloadRepository ?? throw new ArgumentNullException ( nameof ( payloadRepository ) ) ;
55- _storageService = storageService ?? throw new ArgumentNullException ( nameof ( _storageService ) ) ;
55+ _storageService = storageService ?? throw new ArgumentNullException ( nameof ( storageService ) ) ;
5656 }
5757
5858 public static string ServiceName => "Monai Background Service" ;
@@ -110,7 +110,7 @@ private async Task ProcessExpiredPayloads()
110110 {
111111 payloads = ( await _payloadRepository . GetPayloadsToDelete ( DateTime . UtcNow ) . ConfigureAwait ( false ) ) . ToList ( ) ;
112112
113- if ( payloads . Any ( ) )
113+ if ( payloads . Count != 0 )
114114 {
115115 var ids = payloads . Select ( p => p . PayloadId ) . ToList ( ) ;
116116
Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ public async Task PayloadServiceCreate_Should_Call_GetExpiry()
483483 FileCount = 0
484484 } ) ;
485485
486- var daysdiff = ( payload ! . Expires - DateTime . UtcNow ) . Value . TotalDays + 0.5 ;
486+ var daysdiff = ( payload ! . Expires ! - DateTime . UtcNow ) . Value . TotalDays + 0.5 ;
487487
488488 Assert . Equal ( 99 , ( int ) daysdiff ) ;
489489 }
You can’t perform that action at this time.
0 commit comments