Merge pull request #917 from Hellowlol/apifasterplx

Respect cache.
This commit is contained in:
echel0n 2014-11-18 19:45:00 -08:00
commit e57fa4d585
2 changed files with 14 additions and 13 deletions

View File

@ -101,15 +101,12 @@ class ShowContainer(dict):
#keep only the 100th latest results
if time.time() - self._lastgc > 20:
tbd = self._stack[:-100]
i = 0
for o in tbd:
for o in self._stack[:-100]:
del self[o]
del self._stack[i]
i += 1
_lastgc = time.time()
del tbd
self._stack = self._stack[-100:]
self._lastgc = time.time()
super(ShowContainer, self).__setitem__(key, value)

View File

@ -1164,8 +1164,12 @@ def mapIndexersToShow(showObj):
# for each mapped entry
for curResult in sqlResults:
nlist = [i for i in curResult if i is not None]
# Check if its mapped with both tvdb and tvrage.
if len(nlist) >= 4:
logger.log(u"Found indexer mapping in cache for show: " + showObj.name, logger.DEBUG)
mapped[int(curResult['mindexer'])] = int(curResult['mindexer_id'])
return mapped
else:
sql_l = []
for indexer in sickbeard.indexerApi().indexers: