`await new Promise((resolve) => setTimeout(resolve, 1000))` is not awaiting

Hey, I'm struggling to understand why await new Promise((resolve) => setTimeout(resolve, 1000)) is not sleeping for one second. Say I have endpoint that is supposed to sleep for 1 second and retry but instead it will just go as if one sec was one ms:
No description
2 Replies
Luka
Luka•4mo ago
I recall reading that time doesn't exist on cloudflare workers but I cannot find any reference on that. Cursor also doesn't know :((
No description
Luka
Luka•4mo ago
It actually works but the log will not output until request is complete, hence my confusion 😄