From 7231362092882b007ca3b3fa8f7dd941f08bbeb8 Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 11 May 2014 10:55:42 +0200 Subject: [PATCH] added sleep during loading series initially to reduce system load --- update.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/update.c b/update.c index 1dd952f..8394678 100644 --- a/update.c +++ b/update.c @@ -13,7 +13,7 @@ extern cScraper2VdrConfig config; -cUpdate::cUpdate(cScrapManager *manager) : cThread("update thread started") { +cUpdate::cUpdate(cScrapManager *manager) : cThread("update thread started", true) { connection = NULL; vdrDb = NULL; tEvents = NULL; @@ -476,6 +476,7 @@ int cUpdate::ReadSeries(bool isRec) { bool isNew = false; int numNew = 0; + int i=0; while (scrapManager->GetNextSeries(isRec, seriesId, episodeId) && Running()) { cTVDBSeries *series = scrapManager->GetSeries(seriesId); if (!series) { @@ -490,7 +491,7 @@ int cUpdate::ReadSeries(bool isRec) { isNew = false; } if (series) { - stringstream sPath(""); + stringstream sPath(""); sPath << imgPathSeries << "/" << seriesId; string seriesPath = sPath.str(); if (episodeId) { @@ -501,6 +502,9 @@ int cUpdate::ReadSeries(bool isRec) { LoadSeriesMedia(series, seriesPath); } } + waitCondition.TimedWait(mutex, 3); + if (++i % 500 == 0) + tell(0, "Loaded %d series, continuing...", i); numNew++; } return numNew;