Skip to content

Commit

Permalink
busy timeout!
Browse files Browse the repository at this point in the history
  • Loading branch information
arvid220u committed Jul 11, 2022
1 parent 214ed0a commit ac3be62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion daemon/db/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ unsafe fn errmsg_to_string(errmsg: *const std::os::raw::c_char) -> String {
impl DB {
pub fn connect(&self) -> Result<SqliteConnection, DbError> {
match SqliteConnection::establish(&self.address) {
Ok(c) => {
Ok(mut c) => {
use diesel::connection::SimpleConnection;
// we sleep for up to 1000 ms while the database is locked
// we also enforce foreign key constraints
c.batch_execute("PRAGMA foreign_keys = ON; PRAGMA busy_timeout = 1000;")?;
Expand Down

0 comments on commit ac3be62

Please sign in to comment.