diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/e621/index.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/api/e621/index.ts b/src/api/e621/index.ts index 32b7fc0..5c5fd2a 100644 --- a/src/api/e621/index.ts +++ b/src/api/e621/index.ts | |||
@@ -2,6 +2,7 @@ import got from "got"; | |||
2 | import config from "../../config"; | 2 | import config from "../../config"; |
3 | import fs from "fs/promises"; | 3 | import fs from "fs/promises"; |
4 | import path from "path"; | 4 | import path from "path"; |
5 | import delay from "../../util/delay"; | ||
5 | 6 | ||
6 | export interface GetPostQuery { | 7 | export interface GetPostQuery { |
7 | tags: readonly string[]; | 8 | tags: readonly string[]; |
@@ -101,7 +102,7 @@ export async function getRandomPost(query: GetPostQuery) { | |||
101 | const post = response.posts[postIndex]; | 102 | const post = response.posts[postIndex]; |
102 | 103 | ||
103 | if (dedupeDb.includes(post.id)) { | 104 | if (dedupeDb.includes(post.id)) { |
104 | await new Promise((resolve) => setTimeout(resolve, 1000)); | 105 | await delay(1000); |
105 | return getRandomPost(query); | 106 | return getRandomPost(query); |
106 | } | 107 | } |
107 | 108 | ||