-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve notification loop exit #5233
Conversation
@@ -77,21 +74,23 @@ await foreach (var resourceEvent in resourceNotificationService.WatchAsync(cance | |||
if (loggingResourceIds.Add(resourceId)) | |||
{ | |||
// Start watching the logs for this resource ID | |||
logWatchTasks.Add(WatchResourceLogs(tcs, resourceId, logTexts, resourceLoggerService, cancellationToken)); | |||
logWatchTasks.Add(WatchResourceLogs(tcs, resourceId, logTexts, resourceLoggerService, cancellationTokenSource)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using logWatchTasks
here to root them to the method so they don't get collected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these would just be on the ThreadPool so they wouldn't be collected, but not sure. Feels safer this way, unless someone says it's fine without.
|
||
await Task.WhenAny(logWatchTasks).ConfigureAwait(false); | ||
} | ||
catch (OperationCanceledException) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this restricted to the case where cancellationTokenSource.IsCancellationRequested==true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
WaitAsync
loop when text is found.OperationCanceledException
as they are expected.Microsoft Reviewers: Open in CodeFlow