diff options
Diffstat (limited to 'base/src')
-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(()) } |