From 68c0be6564b85227a6eca3ea5d7d55b74bfa30b5 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sat, 17 Apr 2021 12:24:28 +0300 Subject: [PATCH] Update index.js --- src/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 065afe4..d4e0d13 100755 --- a/src/index.js +++ b/src/index.js @@ -32,7 +32,7 @@ async function main() { let programs = [] console.log('Parsing:') for (let item of queue) { - if (options.debug) console.time(' time') + if (options.debug) console.time(' Time') const progs = await utils .fetchData(item, config) .then(response => { @@ -56,6 +56,10 @@ async function main() { return program }) }) + .then(() => { + if (options.debug) console.timeEnd(' Time') + }) + .then(utils.sleep(config.delay)) .catch(err => { console.log( ` ${config.site} - ${item.channel.xmltv_id} - ${item.date.format( @@ -63,10 +67,7 @@ async function main() { )} (0 programs)` ) console.log(` Error: ${err.message}`) - }) - .finally(() => { - if (options.debug) console.timeEnd(' time') - utils.sleep(config.delay) + if (options.debug) console.timeEnd(' Time') }) programs = programs.concat(progs)