I have an application that allows users to query sqlite DB. When the application starts, it loads the URL to see if there are any database updates in the background thread.
Unfortunately, this leads to locks if the user selects a function that tries to query the database while the update is in progress.
My question is twofold.
What is the best conflict avoidance strategy in this scenario.
- Copy the database to another file, update it and copy it back
- You have some kind of singleton mode and use it to schedule operations in a queue.
- and wait for the lock to open (although I do not want to resist the user)
Is it possible to pause the background thread before the application terminates and launches updates immediately before the application terminates.
If anyone has any advice, I would appreciate that I need to start the update without requiring the user to stop using the application.
source
share