Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
protocol/service: defensive storage.contains check
Merged fintohaps opened 4 months ago

In the case of the storage.contains call returning an error, it would be preferable to log the error and continue checking for missing repositories.

1 file changed +10 -2 a46f8eb1 47dc2c56
modified crates/radicle-protocol/src/service.rs
@@ -2530,8 +2530,16 @@ where
            if !policy.is_allow() {
                continue;
            }
-
            if self.storage.contains(&rid)? {
-
                continue;
+
            match self.storage.contains(&rid) {
+
                Ok(exists) => {
+
                    if exists {
+
                        continue;
+
                    }
+
                }
+
                Err(err) => {
+
                    log::warn!(target: "protocol::filter", "Failed to check if {rid} exists: {err}");
+
                    continue;
+
                }
            }
            match self.seeds(&rid, [self.node_id()].into()) {
                Ok(seeds) => {