diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-04 17:26:44 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-04 17:26:44 +0100 |
commit | e74d53391acc55772e45cc38791b1f8414b11b9d (patch) | |
tree | bf25cfdd3082a8507f81861432947f3fd1755793 /base | |
parent | 4da2e04eeaf2c6a40b01329d1ae741ac64635f16 (diff) | |
download | jellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar jellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar.bz2 jellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar.zst |
fix search filter
Diffstat (limited to 'base')
-rw-r--r-- | base/src/database.rs | 8 |
1 files changed, 5 insertions, 3 deletions
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(()) } |