Skip stalled requests
This commit is contained in:
parent
8f0c9d9919
commit
c37a56c8ea
@ -83,9 +83,16 @@ async function checkStatus(playlist) {
|
||||
console.info(` ${counter} ${chalk.green('online')} ${chalk.white(channel.url)}`)
|
||||
}
|
||||
} else {
|
||||
const CancelToken = axios.CancelToken
|
||||
const source = CancelToken.source()
|
||||
const timeout = setTimeout(() => {
|
||||
source.cancel()
|
||||
}, config.timeout)
|
||||
|
||||
await instance
|
||||
.get(channel.url)
|
||||
.get(channel.url, { cancelToken: source.token })
|
||||
.then(() => {
|
||||
clearTimeout(timeout)
|
||||
results.push(channel)
|
||||
if (config.debug) {
|
||||
console.info(` ${counter} ${chalk.green('online')} ${chalk.white(channel.url)}`)
|
||||
@ -93,6 +100,7 @@ async function checkStatus(playlist) {
|
||||
})
|
||||
.then(utils.sleep(config.delay))
|
||||
.catch(err => {
|
||||
clearTimeout(timeout)
|
||||
if (err.response && err.response.status === 404) {
|
||||
//console.error(err)
|
||||
if (config.debug) {
|
||||
|
Loading…
Reference in New Issue
Block a user