diff options
Diffstat (limited to 'src/api/e621')
-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 47d5dd1..32b7fc0 100644 --- a/src/api/e621/index.ts +++ b/src/api/e621/index.ts | |||
@@ -52,7 +52,7 @@ async function loadDedupeDb() { | |||
52 | const dd = JSON.parse(d); | 52 | const dd = JSON.parse(d); |
53 | 53 | ||
54 | if (dd instanceof Array) { | 54 | if (dd instanceof Array) { |
55 | dedupeDb = dd.slice(0, -1 * dedupeMax); | 55 | dedupeDb = dd.slice(-1 * dedupeMax); |
56 | } else { | 56 | } else { |
57 | dedupeDb = []; | 57 | dedupeDb = []; |
58 | } | 58 | } |
@@ -101,6 +101,7 @@ export async function getRandomPost(query: GetPostQuery) { | |||
101 | const post = response.posts[postIndex]; | 101 | const post = response.posts[postIndex]; |
102 | 102 | ||
103 | if (dedupeDb.includes(post.id)) { | 103 | if (dedupeDb.includes(post.id)) { |
104 | await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
104 | return getRandomPost(query); | 105 | return getRandomPost(query); |
105 | } | 106 | } |
106 | 107 | ||