Skip to content

Commit 9f9d09f

Browse files
authored
Sleep after creating a prediction before polling for updates (#79)
1 parent a06fa0d commit 9f9d09f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/predictions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ async function createPrediction(options) {
2121

2222
if (wait) {
2323
const { maxAttempts, interval } = wait;
24+
25+
// eslint-disable-next-line no-promise-executor-return
26+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
27+
await sleep(interval || 250);
28+
2429
return this.wait(await prediction, { maxAttempts, interval });
2530
}
2631

0 commit comments

Comments
 (0)