From b4d57ec8ff31c0a95df191579afbbe586036f177 Mon Sep 17 00:00:00 2001 From: David Davis Date: Fri, 13 Jan 2017 15:14:16 -0500 Subject: [PATCH] Prevent a cursor timeout when syncing rpm repos I couldn't actually reproduce the cursor timeout using a variety of configurations for my VM but using a batch size here didn't seem to slow down syncs significantly. fixes #2502 https://pulp.plan.io/issues/2502 --- plugins/pulp_rpm/plugins/importers/yum/purge.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/pulp_rpm/plugins/importers/yum/purge.py b/plugins/pulp_rpm/plugins/importers/yum/purge.py index 3a2e9507b..521636370 100644 --- a/plugins/pulp_rpm/plugins/importers/yum/purge.py +++ b/plugins/pulp_rpm/plugins/importers/yum/purge.py @@ -393,7 +393,9 @@ def _duplicate_key_id_generator_aggregation(unit, fields): # When aggregating over hundreds of thousands of packages, mongo can overflow # To prevent this, mongo needs to be allowed to temporarily use the disk for this transaction - aggregation = unit.objects.aggregate(sort, project, allowDiskUse=True) + # Set the batch size to 5 to prevent a cursor timeout + aggregation = unit.objects.aggregate(sort, project, allowDiskUse=True, + batchSize=5) # loop state tracking vars previous_nevra = None