Added fallback timeout

This commit is contained in:
freearhey 2019-10-27 14:42:01 +03:00
parent d1b4ca2724
commit 905ee58649
1 changed files with 12 additions and 2 deletions

View File

@ -6,8 +6,7 @@ const ffmpeg = require('fluent-ffmpeg')
const verbose = process.env.npm_config_debug || false
const errorLog = 'error.log'
const config = {
timeout: 60000,
delay: 200
timeout: 60
}
let stats = {
@ -43,6 +42,15 @@ async function test() {
}
await new Promise(resolve => {
const timeout = setTimeout(() => {
stats.failures++
writeToLog(country.url, `Timeout exceeded`, item.url)
resolve()
}, config.timeout * 1000)
ffmpeg(item.url, { timeout: config.timeout }).ffprobe((err) => {
if(err) {
@ -54,6 +62,8 @@ async function test() {
}
clearTimeout(timeout)
resolve()
})