Bug 1359546 - use unique cache names for seta data with branch name and build system type. (#2441)

This commit is contained in:
Joel Maher 2017-05-02 10:58:39 -04:00 коммит произвёл GitHub
Родитель bda3f5ee6b
Коммит fd8c377eb2
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -24,21 +24,19 @@ class SETAJobPriorities:
"""
SETA JobPriority Implementation
"""
def __init__(self):
self.cache_key = 'ref_data_names_cache'
def _process(self, project, build_system, job_priorities):
'''Return list of ref_data_name for job_priorities'''
jobs = []
# we cache the reference data names in order to reduce API calls
ref_data_names_map = cache.get(self.cache_key)
cache_key = '{}-{}-ref_data_names_cache'.format(project, build_system)
ref_data_names_map = cache.get(cache_key)
if not ref_data_names_map:
# cache expired so re-build the reference data names map; the map
# contains the ref_data_name of every treeherder *test* job for this project
ref_data_names_map = self._build_ref_data_names(project, build_system)
# update the cache
cache.set(self.cache_key, ref_data_names_map, SETA_REF_DATA_NAMES_CACHE_TIMEOUT)
cache.set(cache_key, ref_data_names_map, SETA_REF_DATA_NAMES_CACHE_TIMEOUT)
# now check the JobPriority table against the list of valid runnable
for jp in job_priorities: