From 0a7648d80b014c00072012f0104dc71786e0225e Mon Sep 17 00:00:00 2001 From: Sude Date: Mon, 17 Feb 2020 19:33:15 +0200 Subject: [PATCH] Use separate thread count option for info threads Adds --info-threads option to set number of threads the downloader uses for getting product info --- include/config.h | 1 + main.cpp | 1 + src/downloader.cpp | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/config.h b/include/config.h index acd607e..fe8e29a 100644 --- a/include/config.h +++ b/include/config.h @@ -283,6 +283,7 @@ class Config // Integers int iRetries; unsigned int iThreads; + unsigned int iInfoThreads; int iWait; size_t iChunkSize; int iProgressInterval; diff --git a/main.cpp b/main.cpp index f884706..78be7a5 100644 --- a/main.cpp +++ b/main.cpp @@ -242,6 +242,7 @@ int main(int argc, char *argv[]) ("automatic-xml-creation", bpo::value(&Globals::globalConfig.dlConf.bAutomaticXMLCreation)->zero_tokens()->default_value(false), "Automatically create XML data after download has completed") ("save-changelogs", bpo::value(&Globals::globalConfig.dlConf.bSaveChangelogs)->zero_tokens()->default_value(false), "Save changelogs when downloading") ("threads", bpo::value(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads") + ("info-threads", bpo::value(&Globals::globalConfig.iInfoThreads)->default_value(4), "Number of threads for getting product info") ("dlc-list", bpo::value(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC") ("progress-interval", bpo::value(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000") ("lowspeed-timeout", bpo::value(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted") diff --git a/src/downloader.cpp b/src/downloader.cpp index 142b8ed..5a57804 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -430,7 +430,7 @@ int Downloader::getGameDetails() } // Create threads - unsigned int threads = std::min(Globals::globalConfig.iThreads, static_cast(gameItemQueue.size())); + unsigned int threads = std::min(Globals::globalConfig.iInfoThreads, static_cast(gameItemQueue.size())); std::vector vThreads; for (unsigned int i = 0; i < threads; ++i) { @@ -446,7 +446,7 @@ int Downloader::getGameDetails() dl_status = DLSTATUS_NOTSTARTED; // Print progress information once per 100ms - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(Globals::globalConfig.iProgressInterval)); std::cerr << "\033[J\r" << std::flush; // Clear screen from the current line down to the bottom of the screen // Print messages from message queue first