Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ def handleLookup(self, args):

storeClientCache = {}
def _get_StoreClient(self, args):
for k, v in self.storeClientCache.items():
if time.time() - v < 30.0:
return k
else:
del self.storeClientCache[k]
cachekey = args.itunes_server or args.appleid
store, lastseen = self.storeClientCache.get(cachekey, (None, None,))
if store:
if time.time() - lastseen < 30.0:
return store
del self.storeClientCache[cachekey]

newSess = pickle.loads(pickle.dumps(self.sess))
Store = StoreClient(newSess)
Expand Down Expand Up @@ -313,7 +314,7 @@ def authedPost(*args, **kwargs):
Store.sess.original_post = Store.sess.post
Store.sess.post = authedPost

self.storeClientCache[Store] = time.time()
self.storeClientCache[cachekey] = (Store, time.time(),)
return Store

def _handleStoreException(self, _e):
Expand Down