diff --git a/server/planning/events/events.py b/server/planning/events/events.py index 6b141ebad..00d8d8dc8 100644 --- a/server/planning/events/events.py +++ b/server/planning/events/events.py @@ -817,7 +817,7 @@ def get_expired_items(self, expiry_datetime, spiked_events_only=False): total_received = 0 total_events = -1 - while True: + while total_received + get_max_recurrent_events() < 10000: # 10k is max elastic limit query["from"] = total_received results = self.search(query)