- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8
 
fix: Ensure PlatformScheduleAction order is preserved #176
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -7,7 +7,15 @@ internal static partial class AsyncScheduler | |
| { | ||
| private static void PlatformScheduleAction(Action a) | ||
| { | ||
| Task.Run(a); | ||
| try | ||
| { | ||
| // Wait for the task to complete to ensure that actions are executed in the correct order. | ||
| Task.Run(a).Wait(); | ||
| } | ||
| catch (Exception) | ||
| { | ||
| // Swallow exceptions to prevent them from propagating to the caller. | ||
| } | ||
                
       | 
||
| } | ||
| } | ||
| } | ||
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.
Do we need a timeout here? Or do we already not timeout, and require the application code return in a timely manner?
Uh oh!
There was an error while loading. Please reload this page.
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 think any amount of wait violates the AsyncScheduler contract, no?
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.
True, this probably isn't good on the caller side of the equation. It still does feel like we need a thread specifically to wait for these tasks, or a pool of 1 that we just submit to.
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.
Perhaps a queue of tasks that get linked together as added and the next is dispatched as the previous finishes?
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.
Yeah, that works as well, potentially very similar to the async queues we've implemented for the CSI spec.
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've updated it to be a chained list of calls. The continueWith should still work even if an action throws an exception. This should allow us to keep the same contract but enforce the order.