File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed
ServiceControl.Audit/Auditing
ServiceControl/Operations Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -223,19 +223,20 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
223223 await auditIngestor . Ingest ( contexts ) ;
224224 }
225225 }
226- catch ( OperationCanceledException ) when ( stoppingToken . IsCancellationRequested )
226+ catch ( Exception e )
227227 {
228- throw ; // Catch again in outer catch
229- }
230- catch ( Exception e ) // show must go on
231- {
232- logger . Info ( "Ingesting messages failed" , e ) ;
233-
234228 // signal all message handling tasks to terminate
235229 foreach ( var context in contexts )
236230 {
237- context . GetTaskCompletionSource ( ) . TrySetException ( e ) ;
231+ _ = context . GetTaskCompletionSource ( ) . TrySetException ( e ) ;
238232 }
233+
234+ if ( e is OperationCanceledException && stoppingToken . IsCancellationRequested )
235+ {
236+ break ; // ExecuteAsync cancelled
237+ }
238+
239+ logger . Info ( "Ingesting messages failed" , e ) ;
239240 }
240241 finally
241242 {
Original file line number Diff line number Diff line change @@ -99,19 +99,20 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
9999 await ingestor . Ingest ( contexts ) ;
100100 }
101101 }
102- catch ( OperationCanceledException ) when ( stoppingToken . IsCancellationRequested )
102+ catch ( Exception e )
103103 {
104- throw ; // Catch again in outer catch
105- }
106- catch ( Exception e ) // show must go on
107- {
108- Logger . Info ( "Ingesting messages failed" , e ) ;
109-
110104 // signal all message handling tasks to terminate
111105 foreach ( var context in contexts )
112106 {
113- context . GetTaskCompletionSource ( ) . TrySetException ( e ) ;
107+ _ = context . GetTaskCompletionSource ( ) . TrySetException ( e ) ;
114108 }
109+
110+ if ( e is OperationCanceledException && stoppingToken . IsCancellationRequested )
111+ {
112+ break ; // ExecuteAsync cancelled
113+ }
114+
115+ Logger . Info ( "Ingesting messages failed" , e ) ;
115116 }
116117 finally
117118 {
You can’t perform that action at this time.
0 commit comments