aboutsummaryrefslogtreecommitdiff
path: root/src/constants.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-02-10 19:30:36 -0600
committermat <github@matdoes.dev>2022-02-10 19:30:36 -0600
commit7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6 (patch)
tree33cf680ac831e43e05cb3b40647a04c370b32d32 /src/constants.ts
parent3effd71de72aa86bfcd61e26f053ca4b7cc46416 (diff)
downloadskyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.gz
skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.tar.bz2
skyblock-api-7d87d0c3e058e1f6a8c129b2808a5e6ade3b47d6.zip
fix leaderboards not loading sometimes, hopefully
Diffstat (limited to 'src/constants.ts')
-rw-r--r--src/constants.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/constants.ts b/src/constants.ts
index 3cc77d2..27f413b 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -8,6 +8,7 @@ import * as constants from './constants.js'
import * as nodeFetch from 'node-fetch'
import NodeCache from 'node-cache'
import { debug } from './index.js'
+import { sleep } from './util.js'
import Queue from 'queue-promise'
import fetch from 'node-fetch'
import { Agent } from 'https'
@@ -51,7 +52,7 @@ async function fetchGithubApi(method: string, route: string, headers?: any, json
return data
} catch {
// if there's an error, wait a second and try again
- await new Promise((resolve) => setTimeout(resolve, 1000))
+ await sleep(1000)
return await fetchGithubApi(method, route, headers, json)
}
}