Pass cancellation token to Dequeue method, and rewrite comment#51794
Pass cancellation token to Dequeue method, and rewrite comment#51794davidwengier merged 1 commit intodotnet:mainfrom
Conversation
sharwell
left a comment
There was a problem hiding this comment.
I'm assuming we are sure DequeueAsync processes the _cancelSource cancellation before whatever other cancellation was involved to lead to the log.
| @@ -230,8 +230,10 @@ private async Task ProcessQueueAsync() | |||
| } | |||
| catch (OperationCanceledException e) when (e.CancellationToken == _cancelSource.Token) | |||
There was a problem hiding this comment.
💡 The other way to do this is:
| catch (OperationCanceledException e) when (e.CancellationToken == _cancelSource.Token) | |
| catch (OperationCanceledException) when (_cancelSource.IsCancellationRequested) |
I'm not sure exactly what you mean, but there is no "other" cancellation. The log happened because of the call to |
The call to Looking at the code, I believe this is correctly handled right now. |
If our server got shut down by the client, and we happened to be waiting to dequeue the next item from the queue, we would log it as an error because it came from an unknown cancellation token. This correctly links everything up.
Then I updated the comment because who understands Past Dave™