diff --git a/lib/dl.js b/lib/dl.js index ef05d74..b475362 100644 --- a/lib/dl.js +++ b/lib/dl.js @@ -49,9 +49,9 @@ export const getMany = (userDb, threadMax, directory, mode) => new Promise((reso const checkError = (currentIndex, type, codeOrError) => { userDb[currentIndex].logs.push(codeOrError.toString()); if (typeof codeOrError === 'number' && userDb[currentIndex].running === mode) { - userDb[currentIndex].running = false; + userDb[currentIndex].running = `finished ${mode}`; --running; - log(ctx, `Finished (via ${type}) ${userDb[currentIndex].user} under ${mode} mode. ${running} processes still running.`); + log(ctx, `Finished (via ${type}) ${userDb[currentIndex].user} under ${mode} mode. ${userDb.filter(elem => elem.running !== `finished ${mode}`).length} users left.`); get(); } };