run PRAGMA optimize on webapi close
recommended by sqlite
This commit is contained in:
parent
6fc2a3fbfa
commit
c889a14bac
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@ async def app_before_serving():
|
|||
|
||||
@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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue