Repository navigation
fix(debug): don't insert task boundaries between events - #88459
Conversation
See discussion in microsoft/vscode-js-debug#206. This PR adjusts logic such that we only assert task boundaries around requests and responses, rather than around every single event. I believe this will solve the primary case where misordering can happen, as given in the existing unit test and described more verbosely in the doc comment in this PR. A more conservative approach would be to only omit the boundary between events of the same type. That would be safer, but I browsing through the code I didn't see any cases where it looked like we could get tripped up by bucketing here (e.g. cases where we resolve a deferred promise in an event handler). Seems to fix the performance issue for me.
|
Test issue appears unrelated |
| * is assigned if they're processed in the same task. Inserting a task | ||
| * boundary avoids this issue. | ||
| */ | ||
| protected needsTaskBoundaryBetween(messageA: DebugProtocol.ProtocolMessage, messageB: DebugProtocol.ProtocolMessage) { |
There was a problem hiding this comment.
My personal preference is that this should be a helper function not a protected method on the abstractDebugAdapter
There was a problem hiding this comment.
My thought was that if an adapter implementation does something where they need a task boundary between a certain event type, they could override this method with their own check.
|
Connor Peet (@connor4312) nice work! Both of my comments are "optional" so feel free to merge in -> approved. |
|
The change looks good to me. For the test, I'd suggest something like this to ensure we are called in the same microtask: |
|
Yea I think Dmitry's approach is good for a test case. It's hard to reliably test speed but we can make sure events get processed together. |
* fix(debug): don't insert task boundaries between events See discussion in microsoft/vscode-js-debug#206. This PR adjusts logic such that we only assert task boundaries around requests and responses, rather than around every single event. I believe this will solve the primary case where misordering can happen, as given in the existing unit test and described more verbosely in the doc comment in this PR. A more conservative approach would be to only omit the boundary between events of the same type. That would be safer, but I browsing through the code I didn't see any cases where it looked like we could get tripped up by bucketing here (e.g. cases where we resolve a deferred promise in an event handler). Seems to fix the performance issue for me. * fixup! add unit tests for ordering
See discussion in microsoft/vscode-js-debug#206.
This PR adjusts logic such that we only assert task boundaries around
requests and responses, rather than around every single event. I believe
this will solve the primary case where misordering can happen, as given
in the existing unit test and described more verbosely in the doc
comment in this PR.
A more conservative approach would be to only omit the boundary between
events of the same type. That would be safer, but I browsing through
the code I didn't see any cases where it looked like we could get
tripped up by bucketing here (e.g. cases where we resolve a deferred
promise in an event handler).
Seems to fix the performance issue for me.
cc Dmitry Gozman (@dgozman) and SteVen Batten (@sbatten) roblourens fyi