mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 08:42:59 -07:00
Cache GitHub data with release version
This commit is contained in:
parent
74d6b18b47
commit
407af0450f
1 changed files with 7 additions and 2 deletions
|
@ -441,7 +441,9 @@ def github_cache(cache, github_data=None, use_cache=True):
|
|||
cache_filepath = os.path.join(plexpy.CONFIG.CACHE_DIR, 'github_{}.json'.format(cache))
|
||||
|
||||
if github_data:
|
||||
cache_data = {'github_data': github_data, '_cache_time': timestamp}
|
||||
cache_data = {'github_data': github_data,
|
||||
'_cache_time': timestamp,
|
||||
'_release_version': common.RELEASE}
|
||||
try:
|
||||
with open(cache_filepath, 'w', encoding='utf-8') as cache_file:
|
||||
json.dump(cache_data, cache_file)
|
||||
|
@ -453,7 +455,10 @@ def github_cache(cache, github_data=None, use_cache=True):
|
|||
try:
|
||||
with open(cache_filepath, 'r', encoding='utf-8') as cache_file:
|
||||
cache_data = json.load(cache_file)
|
||||
if timestamp - cache_data['_cache_time'] < plexpy.CONFIG.CHECK_GITHUB_CACHE_SECONDS:
|
||||
if (
|
||||
timestamp - cache_data['_cache_time'] < plexpy.CONFIG.CHECK_GITHUB_CACHE_SECONDS and
|
||||
cache_data['_release_version'] == common.RELEASE
|
||||
):
|
||||
logger.debug('Using cached GitHub %s data', cache)
|
||||
return cache_data['github_data']
|
||||
except:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue