Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 9be577c

Browse files
committed
Use autocommit when fetching sequence values
1 parent 201d2da commit 9be577c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

synapse/storage/util/id_generators.py

+3
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,13 @@ class _MultiWriterCtxManager:
598598
stream_ids = attr.ib(type=List[int], factory=list)
599599

600600
async def __aenter__(self) -> Union[int, List[int]]:
601+
# It's safe to run this in autocommit mode as fetching values from a
602+
# sequence ignores transaction semantics anyway.
601603
self.stream_ids = await self.id_gen._db.runInteraction(
602604
"_load_next_mult_id",
603605
self.id_gen._load_next_mult_id_txn,
604606
self.multiple_ids or 1,
607+
db_autocommit=True,
605608
)
606609

607610
# Assert the fetched ID is actually greater than any ID we've already

0 commit comments

Comments
 (0)