summary refs log tree commit diff
path: root/synapse/storage/database.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2023-03-07 08:51:34 +0000
committerGitHub <noreply@github.com>2023-03-07 08:51:34 +0000
commitc69aae94cda9b62b2a82584b2f5ee72a95feb435 (patch)
treeab8705c1a4dcedad60e21651f52d9f44ebf4352d /synapse/storage/database.py
parentPass the requester during event serialization. (#15174) (diff)
downloadsynapse-c69aae94cda9b62b2a82584b2f5ee72a95feb435.tar.xz
Split up txn for fetching device keys (#15215)
We look up keys in batches, but we should do that outside of the
transaction to avoid starving the database pool.
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r--synapse/storage/database.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py

index feaa6cdd07..5efe31aa19 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py
@@ -672,7 +672,15 @@ class DatabasePool: f = cast(types.FunctionType, func) # type: ignore[redundant-cast] if f.__closure__: for i, cell in enumerate(f.__closure__): - if inspect.isgenerator(cell.cell_contents): + try: + contents = cell.cell_contents + except ValueError: + # cell.cell_contents can raise if the "cell" is empty, + # which indicates that the variable is currently + # unbound. + continue + + if inspect.isgenerator(contents): logger.error( "Programming error: function %s references generator %s " "via its closure",