Skip to content

Commit

Permalink
fix: handle anilist 500 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Jan 20, 2024
1 parent 1bb7719 commit f5cd3d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/modules/anilist.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ let rl = null
limiter.on('failed', async (error, jobInfo) => {
printError(error)

if (error.status === 500) return 1

if (!error.statusText) {
if (!rl) rl = sleep(61 * 1000).then(() => { rl = null })
return 61 * 1000
Expand All @@ -77,7 +79,7 @@ const handleRequest = limiter.wrap(async opts => {
} catch (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
}
let json = null
Expand Down

0 comments on commit f5cd3d7

Please sign in to comment.