In the patches for "queue a task" in the task attribution integration section, that algorithm calls "get current task", which accesses the event loop's task scope task. This is problematic since "queue a task" can be called in parallel (i.e. off the main thread), which can cause it to get the wrong task ID.
Since "queue a task" will happen at some indeterminate later point after the high priority task returns, the callback task might have no priority information, or it might happen to finish waiting when the low-priority task is running, in which case it will end up having a low priority.
I'm not sure how this could be fixed, other than by explicitly passing the parent task around every time something runs in parallel.
In the patches for "queue a task" in the task attribution integration section, that algorithm calls "get current task", which accesses the event loop's task scope task. This is problematic since "queue a task" can be called in parallel (i.e. off the main thread), which can cause it to get the wrong task ID.
Imagine the following hypothetical web API:
Take the following code:
Since "queue a task" will happen at some indeterminate later point after the high priority task returns, the callback task might have no priority information, or it might happen to finish waiting when the low-priority task is running, in which case it will end up having a low priority.
I'm not sure how this could be fixed, other than by explicitly passing the parent task around every time something runs in parallel.