mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Stop running queries in parallel, refs #2189
This commit is contained in:
parent
c0227ac7c7
commit
c0d58a71b9
1 changed files with 3 additions and 9 deletions
|
|
@ -172,20 +172,14 @@ class TableView(DataView):
|
||||||
raise NotFound("Database not found: {}".format(database_route))
|
raise NotFound("Database not found: {}".format(database_route))
|
||||||
database_name = db.name
|
database_name = db.name
|
||||||
|
|
||||||
# For performance profiling purposes, ?_noparallel=1 turns off asyncio.gather
|
# We always now run queries sequentially, rather than with asyncio.gather() -
|
||||||
async def _gather_parallel(*args):
|
# see https://github.com/simonw/datasette/issues/2189
|
||||||
return await asyncio.gather(*args)
|
async def gather(*args):
|
||||||
|
|
||||||
async def _gather_sequential(*args):
|
|
||||||
results = []
|
results = []
|
||||||
for fn in args:
|
for fn in args:
|
||||||
results.append(await fn)
|
results.append(await fn)
|
||||||
return results
|
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
|
# If this is a canned query, not a table, then dispatch to QueryView instead
|
||||||
canned_query = await self.ds.get_canned_query(
|
canned_query = await self.ds.get_canned_query(
|
||||||
database_name, table_name, request.actor
|
database_name, table_name, request.actor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue