Skip to content
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

Initialize cancellation token in DashboardView constructor #3648

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

krschau
Copy link
Collaborator

@krschau krschau commented Aug 20, 2024

Summary of the pull request

#3619 (comment)
There's still a race condition because InitializeDashboard() does some amount of non-trivial work before initializing _initWidgetsCancellationTokenSource. So it's possible that we could see this sequence:

  • OnLoadedAsync() called, InitializeDashboard() starts running, _initWidgetsCancellationTokenSource still null.
  • OnUnloadedAsync() called, _initWidgetsCancellationTokenSource still null, so no call to Cancel().
  • InitializeDashboard() finally reaches the point where it initializes _initWidgetsCancellationTokenSource, but because OnUnloadedAsync() is already finished, the cancellation never gets called.

Instead, we should initialize the cancellation token in the constructor, so even in this case InitializeDashboard will eventually see the cancellation.

References and relevant issues

Detailed description of the pull request / Additional comments

Validation steps performed

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

Copy link
Member

@DefaultRyan DefaultRyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nonblocking nit for simplifying initialization

@krschau krschau changed the title Initialize cancellation token in DashboardView constructor Initialize cancellation token in DashboardView constructor 🔍 Aug 21, 2024
@krschau krschau changed the title Initialize cancellation token in DashboardView constructor 🔍 Initialize cancellation token in DashboardView constructor Aug 21, 2024
@krschau krschau merged commit 4288bc2 into main Aug 21, 2024
4 checks passed
@krschau krschau deleted the user/krschau/initWidgetsCancellationTokenSource branch August 21, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants