run PRAGMA optimize on webapi close

recommended by sqlite
This commit is contained in:
Luna 2022-08-30 21:10:13 -03:00
parent 6fc2a3fbfa
commit c889a14bac

View file

@ -42,6 +42,10 @@ async def app_before_serving():
@app.after_serving @app.after_serving
async def app_after_serving(): async def app_after_serving():
log.info("possibly optimizing database")
await app.db.execute("PRAGMA analysis_limit=400")
await app.db.execute("PRAGMA optimize")
log.info("closing connection")
await app.db.close() await app.db.close()