@@ -123,17 +123,17 @@ public async Task RunNowAsync(AutomationPipeline pipeline)
123123 if ( Log . Instance . IsTraceEnabled )
124124 Log . Instance . Trace ( $ "Pipeline run now pending...") ;
125125
126- List < AutomationPipeline > pipelines ;
127- using ( await _ioLock . LockAsync ( ) . ConfigureAwait ( false ) )
128- pipelines = _pipelines . ToList ( ) ;
129-
130126 using ( await _runLock . LockAsync ( ) . ConfigureAwait ( false ) )
131127 {
132128 if ( Log . Instance . IsTraceEnabled )
133129 Log . Instance . Trace ( $ "Pipeline run starting...") ;
134130
135131 try
136132 {
133+ List < AutomationPipeline > pipelines ;
134+ using ( await _ioLock . LockAsync ( ) . ConfigureAwait ( false ) )
135+ pipelines = _pipelines . ToList ( ) ;
136+
137137 var otherPipelines = pipelines . Where ( p => p . Id != pipeline . Id ) . ToList ( ) ;
138138 await pipeline . DeepCopy ( ) . RunAsync ( otherPipelines ) . ConfigureAwait ( false ) ;
139139
@@ -152,14 +152,14 @@ public async Task RunNowAsync(AutomationPipeline pipeline)
152152
153153 public async Task RunNowAsync ( Guid pipelineId )
154154 {
155- using ( await _runLock . LockAsync ( ) . ConfigureAwait ( false ) )
156- {
157- var pipeline = _pipelines . Where ( p => p . Trigger is null ) . FirstOrDefault ( p => p . Id == pipelineId ) ;
158- if ( pipeline is null )
159- return ;
155+ AutomationPipeline ? pipeline ;
156+ using ( await _ioLock . LockAsync ( ) . ConfigureAwait ( false ) )
157+ pipeline = _pipelines . Where ( p => p . Trigger is null ) . FirstOrDefault ( p => p . Id == pipelineId ) ;
160158
161- await RunNowAsync ( pipeline ) . ConfigureAwait ( false ) ;
162- }
159+ if ( pipeline is null )
160+ return ;
161+
162+ await RunNowAsync ( pipeline ) . ConfigureAwait ( false ) ;
163163 }
164164
165165 private async Task RunAsync ( IAutomationEvent automationEvent )
0 commit comments