From f0ae49019b5758389a44477914b7e13b822e791a Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 19 Oct 2021 16:36:56 +0200 Subject: Code improvements --- src/api/e621/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/api/e621/index.ts') 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"; import config from "../../config"; import fs from "fs/promises"; import path from "path"; +import delay from "../../util/delay"; export interface GetPostQuery { tags: readonly string[]; @@ -101,7 +102,7 @@ export async function getRandomPost(query: GetPostQuery) { const post = response.posts[postIndex]; if (dedupeDb.includes(post.id)) { - await new Promise((resolve) => setTimeout(resolve, 1000)); + await delay(1000); return getRandomPost(query); } -- cgit v1.2.3-70-g09d2