mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
c4402a12cc
The `idempotency` test was running **110 concurrent steps** (10 + 100), with each step requiring multiple filesystem operations in the local world: 1. **Step creation** - writes step JSON file 2. **Step update** - reads and overwrites step JSON file 3. **Event creation** - writes event JSON file That's ~3-4 file operations per step × 110 steps = **330-440 total file operations**. On Windows, this is especially slow because: - **NTFS** is slower than ext4/APFS for small file writes - **Windows Defender** real-time scanning adds latency to new file creation - The **atomic write pattern** (write temp file → rename) is slower on Windows Reduced the number of steps from **110 to 20** (5 + 15 instead of 10 + 100): **`workflows/noop.ts`**: - First batch: 10 → 5 steps - Second batch: 100 → 15 steps **`src/idempotency.mts`**: - Updated assertion to expect 20 numbers instead of 110 This is ~5.5x fewer file operations while still testing the same concurrent step execution and idempotency behavior. The test should now complete well within the 60-second timeout even on slow Windows CI machines.
38 lines
655 B
TypeScript
38 lines
655 B
TypeScript
let count = 0;
|
|
export async function noop(_i: number) {
|
|
'use step';
|
|
|
|
count++;
|
|
return count;
|
|
}
|
|
|
|
export async function brokenWf() {
|
|
'use workflow';
|
|
|
|
const numbers = [] as number[];
|
|
|
|
{
|
|
const promises: Promise<number>[] = [];
|
|
for (let i = 0; i < 5; i++) {
|
|
promises.push(noop(i));
|
|
}
|
|
|
|
console.log('await 5');
|
|
numbers.push(...(await Promise.all(promises)));
|
|
}
|
|
|
|
{
|
|
const promises: Promise<number>[] = [];
|
|
for (let i = 0; i < 15; i++) {
|
|
promises.push(noop(100 + i));
|
|
}
|
|
|
|
console.log('await 15');
|
|
numbers.push(...(await Promise.all(promises)));
|
|
}
|
|
|
|
console.log('done.');
|
|
|
|
return { numbers };
|
|
}
|