Skip to content

Commit

Permalink
fix #3318: ignore invalid commands for old builds
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Sep 13, 2023
1 parent 4c5db58 commit a111cc4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/shared/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,17 @@ export function createChannel(streamIn: StreamIn): StreamOut {

if (typeof request.key === 'number') {
const requestCallbacks = requestCallbacksByKey[request.key]
if (requestCallbacks) {
const callback = requestCallbacks[request.command]
if (callback) {
await callback(id, request)
return
}
if (!requestCallbacks) {
// Ignore invalid commands for old builds that no longer exist.
// This can happen when "context.cancel" and "context.dispose"
// is called while esbuild is processing many files in parallel.
// See https://github.com/evanw/esbuild/issues/3318 for details.
return
}
const callback = requestCallbacks[request.command]
if (callback) {
await callback(id, request)
return
}
}

Expand Down

0 comments on commit a111cc4

Please sign in to comment.