-
Notifications
You must be signed in to change notification settings - Fork 599
Closed
Description
Previously: #6019
This is on compatibilityDate = "2026-02-07"
export default {
async test(ctrl, env, ctx) {
const t0 = Date.now()
console.log('A', t0, Date.now() - t0)
await new Promise((accept) => setTimeout(accept, 50))
console.log('B', t0, Date.now() - t0)
for (let j=0; j<1e9; j++); // this is not actually required if something else is going on
await new Promise((accept) => setTimeout(accept, 50))
console.log('C', t0, Date.now() - t0)
await new Promise((accept) => setTimeout(accept, 50))
console.log('D', t0, Date.now() - t0)
await new Promise((accept) => setTimeout(accept, 50))
console.log('E', t0, Date.now() - t0)
await new Promise((accept) => setTimeout(accept, 50))
console.log('F', t0, Date.now() - t0)
}
}Output:
A 1770454880363 0
B 1770454880363 55
C 1770454880363 398
D 1770454880363 398
E 1770454880363 398
F 1770454880363 398
Why do C-D-E-F all fire at the same time when they should be 50ms apart?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels