include write lock in try/finally

This commit is contained in:
Jack Robison 2020-05-01 11:40:52 -04:00
parent b6f6994db4
commit 0a9d4de126
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -137,8 +137,8 @@ class AIOSQLite:
async def run(self, fun, *args, **kwargs):
self.writers += 1
self.read_ready.clear()
async with self.write_lock:
try:
async with self.write_lock:
return await asyncio.get_event_loop().run_in_executor(
self.writer_executor, lambda: self.__run_transaction(fun, *args, **kwargs)
)