Skip to content

Commit 105e6c3

Browse files
authored
Merge pull request #213 from ligangty/cf
Refine the output for cf invalidation request
2 parents 67f60da + adde08c commit 105e6c3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

charon/cache.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
INVALIDATION_BATCH_DEFAULT = 3000
1313
INVALIDATION_BATCH_WILDCARD = 15
1414

15+
INVALIDATION_STATUS_COMPLETED = "Completed"
16+
INVALIDATION_STATUS_INPROGRESS = "InProgress"
17+
1518
DEFAULT_BUCKET_TO_DOMAIN = {
1619
"prod-ga": "maven.repository.redhat.com",
1720
"prod-maven-ga": "maven.repository.redhat.com",
@@ -91,7 +94,7 @@ def invalidate_paths(
9194
current_invalidation = {}
9295
for batch_paths in real_paths:
9396
while (current_invalidation and
94-
'InProgress' == current_invalidation.get('Status', '')):
97+
INVALIDATION_STATUS_INPROGRESS == current_invalidation.get('Status', '')):
9598
time.sleep(5)
9699
try:
97100
result = self.check_invalidation(distr_id, current_invalidation.get('Id'))

charon/pkgs/pkg_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,15 @@ def invalidate_cf_paths(
104104
distr_id, final_paths, real_batch_size
105105
)
106106
if result:
107+
output = {}
108+
for invalidation in result:
109+
status = invalidation.get('Status')
110+
if status not in output:
111+
output[status] = []
112+
output[status].append(invalidation["Id"])
107113
logger.info(
108114
"The CF invalidating request for metadata/indexing is sent, "
109-
"request status as below:\n %s", result
115+
"request result as below:\n %s", output
110116
)
111117
else:
112118
logger.error(

0 commit comments

Comments
 (0)