From ca1d70dfa15c51b3a9888699743a6b9eec7ede16 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 2 Apr 2024 10:27:17 -0700 Subject: [PATCH] Remove any order_by to ensure values_list is properly unique. --- kolibri/core/content/utils/content_request.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kolibri/core/content/utils/content_request.py b/kolibri/core/content/utils/content_request.py index 0d72ac3f42..c3fde60dae 100644 --- a/kolibri/core/content/utils/content_request.py +++ b/kolibri/core/content/utils/content_request.py @@ -584,7 +584,9 @@ def process_metadata_import(incomplete_downloads_without_metadata): preferred_instance_ids = list( incomplete_downloads_without_metadata.values_list( "source_instance_id", flat=True - ).distinct() + ) + # Remove any ordering to ensure the distinct makes the list properly unique. + .order_by().distinct() ) version_filter = ">=0.16.0" preferred_peers = PreferredDevicesWithClient(