From e74d53391acc55772e45cc38791b1f8414b11b9d Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 4 Feb 2025 17:26:44 +0100 Subject: fix search filter --- base/src/database.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'base/src') diff --git a/base/src/database.rs b/base/src/database.rs index 2eecbf6..f1e023c 100644 --- a/base/src/database.rs +++ b/base/src/database.rs @@ -10,7 +10,7 @@ use jellycommon::{ Node, NodeID, }; use log::info; -use redb::{ReadableTable, StorageError, TableDefinition}; +use redb::{Durability, ReadableTable, StorageError, TableDefinition}; use std::{ fs::create_dir_all, path::Path, @@ -103,7 +103,7 @@ impl Database { } pub fn clear_nodes(&self) -> Result<()> { - let txn = self.inner.begin_write()?; + let mut txn = self.inner.begin_write()?; let mut t_node = txn.open_table(T_NODE)?; let mut t_node_children = txn.open_table(T_NODE_CHILDREN)?; let mut t_node_external_id = txn.open_table(T_NODE_EXTERNAL_ID)?; @@ -118,6 +118,7 @@ impl Database { t_node_external_id, t_import_file_mtime, )); + txn.set_durability(Durability::Eventual); txn.commit()?; Ok(()) } @@ -137,7 +138,7 @@ impl Database { id: NodeID, update: impl FnOnce(&mut Node) -> Result<()>, ) -> Result<()> { - let txn = self.inner.begin_write()?; + let mut txn = self.inner.begin_write()?; let mut t_nodes = txn.open_table(T_NODE)?; let mut t_node_children = txn.open_table(T_NODE_CHILDREN)?; let mut t_node_external_id = txn.open_table(T_NODE_EXTERNAL_ID)?; @@ -151,6 +152,7 @@ impl Database { } t_nodes.insert(&id.0, Ser(node))?; drop((t_nodes, t_node_children, t_node_external_id)); + txn.set_durability(Durability::Eventual); txn.commit()?; Ok(()) } -- cgit v1.2.3-70-g09d2