fix sqlite database locked issues by using an async lock on the database and requiring explicit transaction control (or each command will be its own transaction).

This commit is contained in:
fiatjaf
2021-03-26 19:10:30 -03:00
parent 9cc7052920
commit 85011d23c3
10 changed files with 276 additions and 276 deletions
-10
View File
@@ -79,10 +79,6 @@ def register_blueprints(app: QuartTrio) -> None:
ext_module = importlib.import_module(f"lnbits.extensions.{ext.code}")
bp = getattr(ext_module, f"{ext.code}_ext")
@bp.teardown_request
async def after_request(exc):
await ext_module.db.close_session()
app.register_blueprint(bp, url_prefix=f"/{ext.code}")
except Exception:
raise ImportError(
@@ -122,12 +118,6 @@ def register_request_hooks(app: QuartTrio):
async def before_request():
g.nursery = app.nursery
@app.teardown_request
async def after_request(exc):
from lnbits.core import db
await db.close_session()
@app.after_request
async def set_secure_headers(response):
secure_headers.quart(response)