From 407af0450fd1e8f5bd17ec2214a1a320494a1808 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 19 Mar 2021 18:11:10 -0700 Subject: [PATCH] Cache GitHub data with release version --- plexpy/versioncheck.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py index a36d0f9f..edfc5ae1 100644 --- a/plexpy/versioncheck.py +++ b/plexpy/versioncheck.py @@ -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: