Private GIT

Skip to content
Snippets Groups Projects
Commit e8ffd7ee authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Move name_cache lock to fix error of list modified during iteration

parent de2c451e
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ def addNameToCache(name, indexer_id=0): ...@@ -30,6 +30,7 @@ def addNameToCache(name, indexer_id=0):
name: The show name to cache name: The show name to cache
indexer_id: the TVDB and TVRAGE id that this show should be cached with (can be None/0 for unknown) indexer_id: the TVDB and TVRAGE id that this show should be cached with (can be None/0 for unknown)
""" """
global nameCache global nameCache
cacheDB = db.DBConnection('cache.db') cacheDB = db.DBConnection('cache.db')
...@@ -82,7 +83,7 @@ def saveNameCacheToDb(): ...@@ -82,7 +83,7 @@ def saveNameCacheToDb():
def buildNameCache(show=None): def buildNameCache(show=None):
global nameCache global nameCache
with nameCacheLock:
sickbeard.scene_exceptions.retrieve_exceptions() sickbeard.scene_exceptions.retrieve_exceptions()
if not show: if not show:
...@@ -90,12 +91,10 @@ def buildNameCache(show=None): ...@@ -90,12 +91,10 @@ def buildNameCache(show=None):
for show in sickbeard.showList: for show in sickbeard.showList:
buildNameCache(show) buildNameCache(show)
else: else:
with nameCacheLock:
logger.log(u"Building internal name cache for " + show.name, logger.INFO) logger.log(u"Building internal name cache for " + show.name, logger.INFO)
clearCache(show.indexerid) clearCache(show.indexerid)
for curSeason in [-1] + sickbeard.scene_exceptions.get_scene_seasons(show.indexerid): for curSeason in [-1] + sickbeard.scene_exceptions.get_scene_seasons(show.indexerid):
for name in list(set(sickbeard.scene_exceptions.get_scene_exceptions(show.indexerid, season=curSeason) + [ for name in list(set(sickbeard.scene_exceptions.get_scene_exceptions(show.indexerid, season=curSeason) + [show.name])):
show.name])):
name = sickbeard.helpers.full_sanitizeSceneName(name) name = sickbeard.helpers.full_sanitizeSceneName(name)
if name in nameCache: if name in nameCache:
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment