tauri-plugin-sql
tauri-plugin-sql copied to clipboard
Close all database pools when the app exits
Databases are known to be resilient services, however, it does not mean that the database clients should disregard common protocols when interacting with the database. In particular, it is important to cleanly close database connections when they are no longer needed.
This may be a quality of life improvement for most database. However, for the SQLite it could be especially important to cleanly close the database connection as it runs in-process with the client. In particular, when SQLite is running in the WAL-mode, it would maintain additional my.db-wal and my.db-shm files which are normally deleted, when the database connection is closed. In the current implementation the files remain on disk due to the connection not being closed properly.
This PR makes sure that all outstanding database connections are closed with a lifecycle event RunEvent::Exit happens.
Fixes #153
we require all commits to be signed across Tauri's repositories. Follow this guide to set up commit signing. Once all the commits in this PR are signed we can merge your contribution. Thanks for being part of our community!
@alllex Friendly reminder ping :P GitHub does not allow me to click on the merge button until all commits are signed.
@FabianLars Thank you for the ping, I signed the commit. I hope this should do it!