mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-03 13:06:02 -04:00
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.
This commit is contained in:
parent
41f127e068
commit
c69aae94cd
3 changed files with 26 additions and 9 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue