Sorry for bugging you. A couple other things:1) Just curious about using offset approach for merging OR queries, and how that affects performance. If result set is large, then each subsequent chunked query seems it could get progressively slower?2) The merging code in ORQuery.fetch is kind of scary. I didn't try to wrap my head around it. I guess you're comfortable it handles all edge cases :-)Thanks and much appreciated!On Tue, Jun 25, 2024 at 3:45 PM Jacob Gur <ja...@fareclock.com> wrote:Here's screenshot of diff for visualization:On Tue, Jun 25, 2024 at 3:43 PM Jacob Gur <ja...@fareclock.com> wrote:Also for some reason, it does not repro in unit test. Only in cloud datastore.On Tue, Jun 25, 2024 at 3:42 PM Jacob Gur <ja...@fareclock.com> wrote:Hi Luke!It looks like ChunkedResultset._fetch has an infinite loop bug, or maybe its caller does based on what it yields. Was seeing it occur on a query like this:SELECT (*) FROM timeclock_tcemployee WHERE (active=True AND account_id=716859318297101 AND rolesarray_contains_all['worker'] AND labelsarray_contains3191065176237289) OR (active=True AND account_id=716859318297101 AND rolesarray_contains_all['worker'] AND labelsarray_contains966208829868309) OR (active=True AND account_id=716859318297101 AND rolesarray_contains_all['worker'] AND labelsarray_contains4365024065786519) OR (active=True AND account_id=716859318297101 AND rolesarray_contains_all['worker'] AND labelsarray_contains1443946820361155)Changing it to the following resolves the issue:def _fetch(self):total = self.limit or math.infoffset = 0limit = self.chunk_sizewhile offset < total:entities = [x for x in self.query.fetch(offset=offset, limit=limit)]for entity in entities:yield entityif len(entities) < limit:breakoffset += self.chunk_sizeThanks!
Potato London Limited a company registered in England and Wales with company number 07178897 at 18 Upper Ground Sea Containers, London, England, SE1 9GL VAT Reg No GB988351763. This e-mail communication, including any attachment, is intended only for the individual(s) or entity named above and to others who have been specifically authorised to receive it. Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of Potato London Limited shall be understood as neither given nor endorsed by it.