2 Commity af1f3eb6ad ... d74fadfbce

Autor SHA1 Wiadomość Data
  Jing Yang d74fadfbce Conditionally execute debugging statement and increase throughput by 8%. 3 lat temu
  Jing Yang 0f650beb1e Remove unnecessary crate path in type names. 3 lat temu
2 zmienionych plików z 6 dodań i 5 usunięć
  1. 5 4
      kvraft/src/snapshot_holder.rs
  2. 1 1
      src/sync_log_entries.rs

+ 5 - 4
kvraft/src/snapshot_holder.rs

@@ -45,9 +45,10 @@ impl<T: Serialize> SnapshotHolder<T> {
 
 impl<T: DeserializeOwned> SnapshotHolder<T> {
     pub fn load_snapshot(&self, snapshot: Snapshot) -> T {
-        bincode::deserialize(&snapshot.data).expect(&*format!(
-            "Deserialization should never fail, {:?}",
-            &snapshot.data
-        ))
+        if let Ok(result) = bincode::deserialize(&snapshot.data) {
+            result
+        } else {
+            panic!("Deserialization should never fail, {:?}", snapshot.data)
+        }
     }
 }

+ 1 - 1
src/sync_log_entries.rs

@@ -34,7 +34,7 @@ impl Event {
 
 #[derive(Clone)]
 pub(crate) struct SyncLogEntriesComms {
-    tx: crate::utils::SharedSender<Event>,
+    tx: SharedSender<Event>,
 }
 
 impl SyncLogEntriesComms {