You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a question come up as I've been working with the Askar Python wrapper.
Consider these lines from the demo script:
asyncwithstore.transaction() astxn:
# ^ should be faster within a transactionforidxinrange(PERF_ROWS):
awaittxn.insert(
"txn",
f"name-{idx}",
b"value",
{"~plaintag": "a", "enctag": "b"},
)
awaittxn.commit()
My question pertains to the await txn.commit() on the final line. As I understand it, after commit has been called, the handle is closed. In other words, it is impossible to do something like:
asyncwithstore.transaction() astxn:
# ^ should be faster within a transactionforidxinrange(PERF_ROWS):
awaittxn.insert(
"txn",
f"name-{idx}",
b"value",
{"~plaintag": "a", "enctag": "b"},
)
awaittxn.commit()
awaittxn.insert(
"txn",
f"name-one-more",
b"value",
{"~plaintag": "a", "enctag": "b"},
)
awaittxn.commit()
Therefore, calling commit should essentially terminate every async with store.transaction() block and can occur only once within the block. My question: why not call commit on exit of the with block (within the context manager itself)? This seems like an ideal case for using this pattern, in fact, from my perspective at least.
Curious to hear your rationale. Thanks!
The text was updated successfully, but these errors were encountered:
I had a question come up as I've been working with the Askar Python wrapper.
Consider these lines from the demo script:
My question pertains to the
await txn.commit()
on the final line. As I understand it, aftercommit
has been called, the handle is closed. In other words, it is impossible to do something like:Therefore, calling
commit
should essentially terminate everyasync with store.transaction()
block and can occur only once within the block. My question: why not callcommit
on exit of thewith
block (within the context manager itself)? This seems like an ideal case for using this pattern, in fact, from my perspective at least.Curious to hear your rationale. Thanks!
The text was updated successfully, but these errors were encountered: