mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 23:52:06 +00:00
fix: handle anilist 500 errors
This commit is contained in:
parent
1bb771992f
commit
f5cd3d745e
1 changed files with 3 additions and 1 deletions
|
|
@ -60,6 +60,8 @@ let rl = null
|
||||||
limiter.on('failed', async (error, jobInfo) => {
|
limiter.on('failed', async (error, jobInfo) => {
|
||||||
printError(error)
|
printError(error)
|
||||||
|
|
||||||
|
if (error.status === 500) return 1
|
||||||
|
|
||||||
if (!error.statusText) {
|
if (!error.statusText) {
|
||||||
if (!rl) rl = sleep(61 * 1000).then(() => { rl = null })
|
if (!rl) rl = sleep(61 * 1000).then(() => { rl = null })
|
||||||
return 61 * 1000
|
return 61 * 1000
|
||||||
|
|
@ -77,7 +79,7 @@ const handleRequest = limiter.wrap(async opts => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!res || res.status !== 404) throw e
|
if (!res || res.status !== 404) throw e
|
||||||
}
|
}
|
||||||
if (!res.ok && res.status === 429) {
|
if (!res.ok && (res.status === 429 || res.status === 500)) {
|
||||||
throw res
|
throw res
|
||||||
}
|
}
|
||||||
let json = null
|
let json = null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue