kojira no_repo_effective_age setting

This commit is contained in:
Mike McLean 2023-05-22 11:41:51 -04:00 committed by Tomas Kopecek
parent 9aab5d5bde
commit b5950bb209
2 changed files with 12 additions and 3 deletions

View file

@ -89,7 +89,7 @@ especially in relation to throttling in creating ``newRepo`` tasks.
Note that you need to have your database set to use UTC, as otherwise Note that you need to have your database set to use UTC, as otherwise
you can end with weird behaviour. For details see you can end with weird behaviour. For details see
https://pagure.io/koji/issue/2159 https://pagure.io/koji/issue/2159
``queue_file = None`` ``queue_file = None``
Writable path could be set here. In such case, kojira will write a Writable path could be set here. In such case, kojira will write a
list of currently monitored tags there with simple statistics in list of currently monitored tags there with simple statistics in
@ -97,6 +97,12 @@ especially in relation to throttling in creating ``newRepo`` tasks.
tags are expired and what is the computed score for them. This can tags are expired and what is the computed score for them. This can
be used to debug and check in realtime the actual performance. be used to debug and check in realtime the actual performance.
``no_repo_effective_age = 2 days (172800)``
When prioritizing repo regens, the age of the expired repo is the primary
factor. This value (measured in seconds) is used when there is no expired
repo (e.g. for a new build tag).
Garbage Collector Garbage Collector
----------------- -----------------

View file

@ -953,13 +953,15 @@ class RepoManager(object):
# how expired are we? # how expired are we?
ts = 0 ts = 0
for repo in tag_repos.get(tag_id, []): for repo in tag_repos.get(tag_id, []):
if repo.problem:
continue
if repo.expire_ts: if repo.expire_ts:
if repo.expire_ts > ts: if repo.expire_ts > ts:
ts = repo.expire_ts ts = repo.expire_ts
else: else:
self.logger.warning("No expire timestamp for repo: %s", repo.repo_id) self.logger.warning("No expire timestamp for repo: %s", repo.repo_id)
if ts == 0: if ts == 0:
ts = time.time() ts = time.time() - self.options.no_repo_effective_age
entry = { entry = {
'taginfo': taginfo, 'taginfo': taginfo,
@ -1273,6 +1275,7 @@ def get_options():
'deleted_repo_lifetime': 7 * 24 * 3600, 'deleted_repo_lifetime': 7 * 24 * 3600,
# XXX should really be called expired_repo_lifetime # XXX should really be called expired_repo_lifetime
'dist_repo_lifetime': 7 * 24 * 3600, 'dist_repo_lifetime': 7 * 24 * 3600,
'no_repo_effective_age': 2 * 24 * 3600,
'check_external_repos': False, 'check_external_repos': False,
'sleeptime': 15, 'sleeptime': 15,
'cert': None, 'cert': None,
@ -1284,7 +1287,7 @@ def get_options():
int_opts = ('deleted_repo_lifetime', 'max_repo_tasks', 'repo_tasks_limit', int_opts = ('deleted_repo_lifetime', 'max_repo_tasks', 'repo_tasks_limit',
'retry_interval', 'max_retries', 'offline_retry_interval', 'retry_interval', 'max_retries', 'offline_retry_interval',
'max_delete_processes', 'max_repo_tasks_maven', 'dist_repo_lifetime', 'max_delete_processes', 'max_repo_tasks_maven', 'dist_repo_lifetime',
'sleeptime') 'sleeptime', 'no_repo_effective_age')
str_opts = ('topdir', 'server', 'user', 'password', 'logfile', 'principal', 'keytab', str_opts = ('topdir', 'server', 'user', 'password', 'logfile', 'principal', 'keytab',
'cert', 'serverca', 'debuginfo_tags', 'queue_file', 'cert', 'serverca', 'debuginfo_tags', 'queue_file',
'source_tags', 'separate_source_tags', 'ignore_tags') 'source_tags', 'separate_source_tags', 'ignore_tags')