From 129ef956b8cf6fe71223630b5cb0d2f980506a05 Mon Sep 17 00:00:00 2001 From: Simon Prickett Date: Mon, 25 Apr 2022 13:05:11 +0100 Subject: [PATCH] Performance improvement for first - avoids unnecessary pagination. --- aredis_om/model/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aredis_om/model/model.py b/aredis_om/model/model.py index 4b71eec..92bb6f9 100644 --- a/aredis_om/model/model.py +++ b/aredis_om/model/model.py @@ -749,7 +749,7 @@ class FindQuery: async def first(self): query = self.copy(offset=0, limit=1, sort_fields=self.sort_fields) - results = await query.execute() + results = await query.execute(exhaust_results=False) if not results: raise NotFoundError() return results[0]