Skip to content

Commit

Permalink
gadgets-sync: timeout calls to 5 s
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Jun 15, 2024
1 parent 23d56f1 commit 1cd1800
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gadgets-sync/gadgets-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,28 @@ async function getConfig() {
continue
}

let remote, local;
let remote, local
try {
remote = await bot.rawRequest({
url: `https://en.wikipedia.org/w/index.php?title=${conf.source}&action=raw`
url: `https://en.wikipedia.org/w/index.php?title=${conf.source}&action=raw`,
timeout: 5000
})
} catch (e) {
if (e.response.status === 404) {
if (e.response?.status === 404) {
log(`[E] ${conf.source} does not exist. Skipping.`)
continue
} else throw e;
} else throw e
}
try {
local = await bot.rawRequest({
url: `https://en.wikipedia.org/w/index.php?title=${conf.page}&action=raw`
url: `https://en.wikipedia.org/w/index.php?title=${conf.page}&action=raw`,
timeout: 5000
})
} catch (e) {
if (e.response.status === 404) {
if (e.response?.status === 404) {
log(`[E] ${conf.page} does not exist. Skipping.`)
continue
} else throw e;
} else throw e
}

const substitutedHeader = header.replaceAll('$SOURCE', conf.source)
Expand Down

0 comments on commit 1cd1800

Please sign in to comment.