tauri-plugin-sql icon indicating copy to clipboard operation
tauri-plugin-sql copied to clipboard

Close all database pools when the app exits

Open alllex opened this issue 3 years ago • 2 comments

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

alllex avatar Oct 10 '22 23:10 alllex

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!

FabianLars avatar Oct 11 '22 11:10 FabianLars

@alllex Friendly reminder ping :P GitHub does not allow me to click on the merge button until all commits are signed.

FabianLars avatar Oct 28 '22 17:10 FabianLars

@FabianLars Thank you for the ping, I signed the commit. I hope this should do it!

alllex avatar Nov 01 '22 10:11 alllex