WatermelonDB icon indicating copy to clipboard operation
WatermelonDB copied to clipboard

fix:The database connection is not closed during the catch block

Open KotoriMinami opened this issue 1 year ago • 1 comments

If this instance is not closed, it will result in the occupation of the database file.

When subsequent calls to setUpWithMigrations or setUpWithSchema reach the execution of unsafeDestroyEverything, https://github.com/Nozbe/WatermelonDB/blob/62774d5ebc4aa9ed6a2f61c8d4e795b32322cec6/src/adapters/sqlite/index.js#L144 https://github.com/Nozbe/WatermelonDB/blob/62774d5ebc4aa9ed6a2f61c8d4e795b32322cec6/src/adapters/sqlite/index.js#L195 Due to the old instance not closing the connection, even though the connection of the new instance is closed, an error resource busy or locked still occurs when executing fs.unlinkSync

This fixes https://github.com/Nozbe/WatermelonDB/issues/1705

KotoriMinami avatar Nov 15 '23 02:11 KotoriMinami

Thanks for the fix @KotoriMinami, but tests no longer pass after this

radex avatar Apr 21 '24 09:04 radex