Use autocommit when fetching sequence values

pull/8456/head
Erik Johnston 2020-10-05 15:22:24 +01:00
parent 201d2da705
commit 9be577c470
1 changed files with 3 additions and 0 deletions

View File

@ -598,10 +598,13 @@ class _MultiWriterCtxManager:
stream_ids = attr.ib(type=List[int], factory=list)
async def __aenter__(self) -> Union[int, List[int]]:
# It's safe to run this in autocommit mode as fetching values from a
# sequence ignores transaction semantics anyway.
self.stream_ids = await self.id_gen._db.runInteraction(
"_load_next_mult_id",
self.id_gen._load_next_mult_id_txn,
self.multiple_ids or 1,
db_autocommit=True,
)
# Assert the fetched ID is actually greater than any ID we've already