File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/ServiceControl/Operations Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ public override async Task StopAsync(CancellationToken cancellationToken)
132132 {
133133 try
134134 {
135+ await stoppingToken . CancelAsync ( ) ;
135136 await watchdog . Stop ( cancellationToken ) ;
136137 channel . Writer . Complete ( ) ;
137138 await base . StopAsync ( cancellationToken ) ;
@@ -261,8 +262,11 @@ async Task StopAndTeardownInfrastructure(CancellationToken cancellationToken)
261262 }
262263 }
263264
264- async Task OnMessage ( MessageContext messageContext , CancellationToken cancellationToken )
265+ async Task OnMessage ( MessageContext messageContext , CancellationToken cancellationTokenParent )
265266 {
267+ using var cts = CancellationTokenSource . CreateLinkedTokenSource ( cancellationTokenParent , stoppingToken . Token ) ;
268+ var cancellationToken = cts . Token ;
269+
266270 if ( settings . MessageFilter != null && settings . MessageFilter ( messageContext ) )
267271 {
268272 return ;
@@ -307,6 +311,7 @@ async Task EnsureStopped(CancellationToken cancellationToken = default)
307311 TransportInfrastructure transportInfrastructure ;
308312 IMessageReceiver messageReceiver ;
309313
314+ readonly CancellationTokenSource stoppingToken = new ( ) ;
310315 readonly Settings settings ;
311316 readonly ITransportCustomization transportCustomization ;
312317 readonly TransportSettings transportSettings ;
You can’t perform that action at this time.
0 commit comments