-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to wait until the database is unlocked? #331
Comments
In the same process, yes you can. |
Thanks, cool. Why nobody merges it? And why I think it should be enabled always if it is used from r2d2. |
Thanks |
Can gwenn please provide a code example for how to use the "unlock-notify" branch. I need to write a re-entrant query function that checks the locked status of the database beforehand and then waits a random time period before retrying. |
Having looked at this branch's code a little more closely, it appears that simply enabling the "unlock_notify" feature means that the internal "prepare" statement will wait until the database is unlocked before exiting. Is there any chance that it could end up waiting forever or an excessively long time? I compiled the application with the following cargo.toml dependency defined. Is this all I have to do to enable this feature? (I'm a Rust Newbie).
|
Currently, there is no timeout but you just have to replace the wait by a wait_timeout |
@gwenn Can this be closed as of https://github.com/jgallagher/rusqlite/pull/349 ? |
Indeed, in next release. |
rusqlite 0.14 released |
I tried to use
r2d2
+diesel
+sqlite
crates for working with my sqlite database from multiple threads. However, it seems to be useless to use connection pool since everytime the database is locked the error is returned immediately without even waiting until it is unlocked by another thread. Is there a wait to specify some timeout for a connection and make it wait until one is free?The text was updated successfully, but these errors were encountered: