Skip to content

Commit

Permalink
Fix async tests not waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
toji committed Nov 2, 2023
1 parent b233b1e commit 774e392
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webgpu/shader/execution/expression/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ export async function run(
void t.queue.onSubmittedWorkDone().finally(batchFinishedCallback);
};

const pendingBatches = [];

for (let i = 0; i < cases.length; i += casesPerBatch) {
const batchCases = cases.slice(i, Math.min(i + casesPerBatch, cases.length));

Expand All @@ -379,8 +381,10 @@ export async function run(
}
batchesInFlight += 1;

void processBatch(batchCases);
pendingBatches.push(processBatch(batchCases));
}

await Promise.all(pendingBatches);
}

/**
Expand Down

0 comments on commit 774e392

Please sign in to comment.