Skip to content

Commit 08bbe03

Browse files
committed
put the got request in a try to prevent timeouts
1 parent a10c238 commit 08bbe03

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

middleware/archived-enterprise-versions.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ module.exports = async (req, res, next) => {
3737
let reqPath = req.path
3838
let isRedirect = false
3939
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutArchivedRedirectsFile}`)) {
40-
const redirectJson = await got(getProxyPath('redirects.json', requestedVersion))
41-
if (redirectJson[req.path]) {
42-
isRedirect = true
40+
try {
41+
const redirectJson = await got(getProxyPath('redirects.json', requestedVersion))
42+
43+
if (redirectJson[req.path]) {
44+
isRedirect = true
45+
}
46+
reqPath = redirectJson[req.path] || req.path
47+
} catch (err) {
48+
// nooop
4349
}
44-
reqPath = redirectJson[req.path] || req.path
4550
}
4651

4752
try {

0 commit comments

Comments
 (0)