Compare commits

...

2 Commits

Author SHA1 Message Date
8810679fd8 Transactions. 2025-03-27 21:01:17 +01:00
9d5815ed10 Transactions. 2025-03-27 21:00:34 +01:00
2 changed files with 2 additions and 2 deletions
src/snek

View File

@ -81,10 +81,12 @@ class Application(BaseApplication):
async def task_runner(self):
while True:
task = await self.tasks.get()
self.db.begin()
try:
await task
except Exception as ex:
print(ex)
self.db.commit()
async def prepare_database(self,app):
self.db.query("PRAGMA journal_mode=WAL")

View File

@ -203,9 +203,7 @@ class RPCView(BaseView):
if msg.type == web.WSMsgType.TEXT:
try:
async with Profiler():
self.app.db.begin()
await rpc(msg.json())
self.app.db.commit()
except Exception as ex:
print(ex, flush=True)
await self.services.socket.delete(ws)