From c0d58a71b93e6d0b88fbf79881bbb75a2dcb6cf2 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Sep 2023 12:23:17 -0700 Subject: [PATCH] Stop running queries in parallel, refs #2189 --- datasette/views/table.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/datasette/views/table.py b/datasette/views/table.py index e80ed217..d479fede 100644 --- a/datasette/views/table.py +++ b/datasette/views/table.py @@ -172,20 +172,14 @@ class TableView(DataView): raise NotFound("Database not found: {}".format(database_route)) database_name = db.name - # For performance profiling purposes, ?_noparallel=1 turns off asyncio.gather - async def _gather_parallel(*args): - return await asyncio.gather(*args) - - async def _gather_sequential(*args): + # We always now run queries sequentially, rather than with asyncio.gather() - + # see https://github.com/simonw/datasette/issues/2189 + async def gather(*args): results = [] for fn in args: results.append(await fn) return results - gather = ( - _gather_sequential if request.args.get("_noparallel") else _gather_parallel - ) - # If this is a canned query, not a table, then dispatch to QueryView instead canned_query = await self.ds.get_canned_query( database_name, table_name, request.actor