Private GIT

Skip to content
Snippets Groups Projects
Commit 8e279dfe authored by bone's avatar bone Committed by miigotu
Browse files

updating a provider cache might entail fetching resources from the network and...

updating a provider cache might entail fetching resources from the network and therefore should only be performed if there is a chance the result will be needed
parent deaf6634
No related branches found
No related tags found
No related merge requests found
...@@ -372,8 +372,6 @@ def searchForNeededEpisodes(): ...@@ -372,8 +372,6 @@ def searchForNeededEpisodes():
didSearch = False didSearch = False
origThreadName = threading.currentThread().name
show_list = sickbeard.showList show_list = sickbeard.showList
fromDate = datetime.date.fromordinal(1) fromDate = datetime.date.fromordinal(1)
episodes = [] episodes = []
...@@ -383,13 +381,20 @@ def searchForNeededEpisodes(): ...@@ -383,13 +381,20 @@ def searchForNeededEpisodes():
sickbeard.name_cache.buildNameCache(curShow) sickbeard.name_cache.buildNameCache(curShow)
episodes.extend(wantedEpisodes(curShow, fromDate)) episodes.extend(wantedEpisodes(curShow, fromDate))
if not episodes:
# nothing wanted so early out, ie: avoid whatever abritrarily
# complex thing a provider cache update entails, for example,
# reading rss feeds
logger.log(u"No episodes needed.", logger.INFO)
return foundResults.values()
origThreadName = threading.currentThread().name
providers = [x for x in sickbeard.providers.sortedProviderList(sickbeard.RANDOMIZE_PROVIDERS) if x.is_active() and x.enable_daily] providers = [x for x in sickbeard.providers.sortedProviderList(sickbeard.RANDOMIZE_PROVIDERS) if x.is_active() and x.enable_daily]
for curProvider in providers: for curProvider in providers:
threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]" threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]"
curProvider.cache.updateCache() curProvider.cache.updateCache()
threading.currentThread().name = origThreadName
for curProvider in providers: for curProvider in providers:
threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]" threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]"
curFoundResults = {} curFoundResults = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment