Skip to content

Commit

Permalink
Merge pull request #817 from ATIX-AG/fix_migration_0025
Browse files Browse the repository at this point in the history
Fix migration 0025
  • Loading branch information
quba42 authored Jul 18, 2023
2 parents 99a9974 + cdcf8a2 commit ae959c5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def _deduplicate_PRC(duplicate_component, component_to_keep):

if len(repo_content_to_update) >= BATCH_SIZE:
RepositoryContent.objects.bulk_update(repo_content_to_update, ["content_id"])
repo_content_to_update = []
message = '{}: Merged PRC batch from duplicate component "{}" into component "{}"!'
log.info(message.format(datetime.now(), duplicate_component, component_to_keep))

# Handle remaining content <= BATCH_SIZE:
if len(repo_content_to_update) > 0:
Expand Down Expand Up @@ -210,7 +213,7 @@ def _deduplicate_PRC(duplicate_component, component_to_keep):
duplicate_component_ids = list(
ReleaseComponent.objects.filter(
distribution=distribution, component=component
).values_list('pk', flat=True)
).order_by('-pulp_created').values_list('pk', flat=True)
)
if len(duplicate_component_ids) > 1:
component_to_keep = duplicate_component_ids.pop()
Expand Down

0 comments on commit ae959c5

Please sign in to comment.