File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
sdk/servicebus/Azure.Messaging.ServiceBus Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -241,8 +241,8 @@ private async Task<ReceivingAmqpLink> OpenReceiverLinkAsync(
241241 // to log here.
242242 throw ;
243243 }
244- catch ( TaskCanceledException )
245- when ( _isProcessor )
244+ catch ( OperationCanceledException )
245+ when ( _isProcessor && cancellationToken . IsCancellationRequested )
246246 {
247247 // do not log this as the processor is shutting down
248248 throw ;
Original file line number Diff line number Diff line change @@ -302,8 +302,8 @@ internal async Task<IReadOnlyList<ServiceBusReceivedMessage>> ReceiveMessagesAsy
302302 maxWaitTime ,
303303 cancellationToken ) . ConfigureAwait ( false ) ;
304304 }
305- catch ( TaskCanceledException ex )
306- when ( isProcessor )
305+ catch ( OperationCanceledException ex )
306+ when ( isProcessor && cancellationToken . IsCancellationRequested )
307307 {
308308 Logger . ProcessorStoppingReceiveCanceled ( Identifier , ex . ToString ( ) ) ;
309309 scope . Failed ( ex ) ;
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ public async Task ReceiveMessagesWhenQueueEmpty()
157157 Assert . ThrowsAsync < TaskCanceledException > ( async ( ) => await receiver . ReceiveMessagesAsync ( 1 , cancellationToken : cancellationTokenSource . Token ) ) ;
158158 var stop = DateTime . UtcNow ;
159159
160- Assert . That ( stop - start , Is . EqualTo ( TimeSpan . FromSeconds ( 3 ) ) . Within ( TimeSpan . FromSeconds ( 3 ) ) ) ;
160+ Assert . That ( stop - start , Is . EqualTo ( TimeSpan . FromSeconds ( 3 ) ) . Within ( TimeSpan . FromSeconds ( 5 ) ) ) ;
161161 }
162162 }
163163
@@ -230,7 +230,7 @@ public async Task CancellingDoesNotBlockSubsequentReceives(bool prefetch)
230230 Assert . AreEqual ( 1 , msg . DeliveryCount ) ;
231231 var end = DateTime . UtcNow ;
232232 Assert . NotNull ( msg ) ;
233- Assert . Less ( end - start , TimeSpan . FromSeconds ( 5 ) ) ;
233+ Assert . Less ( end - start , TimeSpan . FromSeconds ( 10 ) ) ;
234234 }
235235 }
236236
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ public async Task ReceiveMessagesWhenQueueEmpty()
244244 Assert . ThrowsAsync < TaskCanceledException > ( async ( ) => await receiver . ReceiveMessagesAsync ( 1 , cancellationToken : cancellationTokenSource . Token ) ) ;
245245 var stop = DateTime . UtcNow ;
246246
247- Assert . That ( stop - start , Is . EqualTo ( TimeSpan . FromSeconds ( 3 ) ) . Within ( TimeSpan . FromSeconds ( 3 ) ) ) ;
247+ Assert . That ( stop - start , Is . EqualTo ( TimeSpan . FromSeconds ( 3 ) ) . Within ( TimeSpan . FromSeconds ( 5 ) ) ) ;
248248 }
249249 }
250250
@@ -1014,7 +1014,7 @@ public async Task CancellingDoesNotBlockSubsequentReceives(bool prefetch)
10141014 Assert . AreEqual ( 1 , msg . DeliveryCount ) ;
10151015 var end = DateTime . UtcNow ;
10161016 Assert . NotNull ( msg ) ;
1017- Assert . Less ( end - start , TimeSpan . FromSeconds ( 5 ) ) ;
1017+ Assert . Less ( end - start , TimeSpan . FromSeconds ( 10 ) ) ;
10181018 }
10191019 }
10201020 }
You can’t perform that action at this time.
0 commit comments