Permalink
Browse files

Each torrent gets its own cache update timestamp

  • Loading branch information...
1 parent d8d8885 commit 97afdd8871f0685e1bd377bb76d10d260d8fd320 Benjamin committed Mar 3, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 transmission-remote-cli.py
@@ -727,7 +727,6 @@ def __init__(self, server):
self.server = server
self.funcs = dict()
self.cache = dict()
- self.cache_update = 0
for func_name in dir(self):
if func_name.startswith('get_'):
self.funcs[func_name.lstrip('get_')] = getattr(self, func_name,
@@ -737,8 +736,8 @@ def __init__(self, server):
def parse(self, line_format, torrent):
if torrent['id'] not in self.cache:
self.cache[torrent['id']] = dict()
- if not self.cache[torrent['id']] or time.time() - self.cache_update > 1:
- self.cache_update = time.time()
+ if not self.cache[torrent['id']] or time.time() - self.cache[torrent['id']]['update_time'] > 1:
+ self.cache[torrent['id']]['update_time'] = time.time()
return self._parse(line_format, torrent)
else:
return self.cache[torrent['id']][line_format]

0 comments on commit 97afdd8

Please sign in to comment.