1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Fix for possible infinitie loop in searches

This commit is contained in:
echel0n 2014-05-17 09:43:34 -07:00
parent 0afdeb3c1f
commit 905d2b4eaf
2 changed files with 17 additions and 9 deletions

View File

@ -95,18 +95,23 @@ class DailySearcher():
# ask all providers for any episodes it finds
threadName = threading.currentThread().name
for curProvider in [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]:
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
for curProviderCount, curProvider in enumerate(providers):
threading.currentThread().name = threadName + ":[" + curProvider.name + "]"
try:
curFoundResults = curProvider.searchRSS()
except exceptions.AuthException, e:
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
continue
if curProviderCount != len(providers):
continue
break
except Exception, e:
logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)
continue
if curProviderCount != len(providers):
continue
break
didSearch = True
@ -143,4 +148,4 @@ class DailySearcher():
u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
logger.ERROR)
return foundResults.values()
return foundResults.values() if len(foundResults) else {}

View File

@ -354,11 +354,11 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
searchResults = provider.findSearchResults(show, season, episodes, search_mode, manualSearch)
except exceptions.AuthException, e:
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
continue
break
except Exception, e:
logger.log(u"Error while searching " + provider.name + ", skipping: " + ex(e), logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)
continue
break
if len(searchResults):
foundResults[provider.name] = filterSearchResults(show, searchResults)
@ -375,7 +375,10 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
# skip to next provider if we have no results to process
if not len(foundResults[provider.name]):
continue
if providerNum != len(providers):
continue
break
anyQualities, bestQualities = Quality.splitQuality(show.quality)
@ -580,7 +583,7 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
wantedEpCount += 1
# make sure we search every provider for results unless we found everything we wanted
if providerNum != len(providers) and wantedEpCount != len(episodes):
continue
if providerNum == len(providers) or wantedEpCount == len(episodes):
break
return queueItem