From e677bceff870ecef5a7718def9d289bdd70bcc95 Mon Sep 17 00:00:00 2001 From: lucaslinhares Date: Thu, 10 Oct 2024 16:36:56 -0300 Subject: [PATCH] Remove call to archive to get s3 runs --- temba/flows/models.py | 16 ++++++++-------- temba/flows/tests.py | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/temba/flows/models.py b/temba/flows/models.py index a8e94b39fe0..790269c74da 100644 --- a/temba/flows/models.py +++ b/temba/flows/models.py @@ -1983,7 +1983,7 @@ def _get_run_batches(self, flows, responded_only): logger.info(f"Results export #{self.id} for org #{self.org.id}: fetching runs from archives to export...") # firstly get runs from archives - from temba.archives.models import Archive + # from temba.archives.models import Archive # get the earliest created date of the flows being exported earliest_created_on = None @@ -1995,15 +1995,15 @@ def _get_run_batches(self, flows, responded_only): where = {"flow__uuid__in": flow_uuids} if responded_only: where["responded"] = True - records = Archive.iter_all_records(self.org, Archive.TYPE_FLOWRUN, after=earliest_created_on, where=where) + # records = Archive.iter_all_records(self.org, Archive.TYPE_FLOWRUN, after=earliest_created_on, where=where) seen = set() - for record_batch in chunk_list(records, 1000): - matching = [] - for record in record_batch: - seen.add(record["id"]) - matching.append(record) - yield matching + # for record_batch in chunk_list(records, 1000): + # matching = [] + # for record in record_batch: + # seen.add(record["id"]) + # matching.append(record) + # yield matching # secondly get runs from database runs = FlowRun.objects.filter(flow__in=flows).order_by("modified_on").using("readonly") diff --git a/temba/flows/tests.py b/temba/flows/tests.py index b1c32767a60..0965c446985 100644 --- a/temba/flows/tests.py +++ b/temba/flows/tests.py @@ -4063,7 +4063,7 @@ def test_export_results(self, mr_mocks): # make sure that we trigger logger log_info_threshold.return_value = 1 - with self.assertNumQueries(45): + with self.assertNumQueries(44): workbook = self._export(flow, group_memberships=[devs]) self.assertEqual(len(captured_logger.output), 3) @@ -4309,7 +4309,7 @@ def msg_event_time(run, text): ) # test without msgs or unresponded - with self.assertNumQueries(43): + with self.assertNumQueries(42): workbook = self._export(flow, include_msgs=False, responded_only=True, group_memberships=(devs,)) tz = self.org.timezone @@ -4375,7 +4375,7 @@ def msg_event_time(run, text): ) # test export with a contact field - with self.assertNumQueries(45): + with self.assertNumQueries(44): workbook = self._export( flow, include_msgs=False,