Add `--timeout` parameter
This commit is contained in:
parent
5751506340
commit
5a378b8c42
|
@ -2,7 +2,6 @@ const { program } = require('commander')
|
||||||
const helper = require('./helper')
|
const helper = require('./helper')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const ProgressBar = require('progress')
|
const ProgressBar = require('progress')
|
||||||
const instance = axios.create({ timeout: 1000, maxContentLength: 1000 })
|
|
||||||
|
|
||||||
program
|
program
|
||||||
.version('1.0.0', '-v, --version')
|
.version('1.0.0', '-v, --version')
|
||||||
|
@ -13,10 +12,13 @@ program
|
||||||
.option('--epg', 'Turn on EPG parser')
|
.option('--epg', 'Turn on EPG parser')
|
||||||
.option('--resolution', 'Turn on resolution parser')
|
.option('--resolution', 'Turn on resolution parser')
|
||||||
.option('--delay <delay>', 'Delay between parser requests', 0)
|
.option('--delay <delay>', 'Delay between parser requests', 0)
|
||||||
|
.option('--timeout <timeout>', 'Set timeout for each request', 5000)
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const config = program.opts()
|
const config = program.opts()
|
||||||
|
|
||||||
|
const instance = axios.create({ timeout: config.timeout, maxContentLength: 1000 })
|
||||||
|
|
||||||
let globalBuffer = []
|
let globalBuffer = []
|
||||||
let bar
|
let bar
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue