Fast and robust atproto CAR file processing in rust
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

clean up panic

phil 1d45b0ce 5eef99d9

+3 -8
+3 -8
src/drive.rs
··· 20 20 BadRecord(Box<dyn Error>), 21 21 #[error("The Commit block reference by the root was not found")] 22 22 MissingCommit, 23 + #[error("The MST block {0} could not be found")] 24 + MissingBlock(Cid), 23 25 #[error("Failed to walk the mst tree: {0}")] 24 26 Tripped(#[from] Trip), 25 27 #[error("Not finished walking, but no more blocks are available to continue")] ··· 145 147 } 146 148 }; 147 149 148 - let mut found_any = false; 149 150 // load blocks until we reach that cid 150 151 while let Some((cid, data)) = vehicle 151 152 .block_stream ··· 153 154 .await 154 155 .map_err(|e| DriveError::CarBlockError(e.into()))? 155 156 { 156 - found_any = true; 157 157 let val = if Node::could_be(&data) { 158 158 MaybeProcessedBlock::Raw(data) 159 159 } else { ··· 166 166 } 167 167 }; 168 168 169 - if !found_any { 170 - panic!("walker unfinished but no more blocks to load"); 171 - } 169 + return Err(DriveError::MissingBlock(cid_needed)); 172 170 } 173 - 174 - // pause to let macos activity monitor's memory stat update, definitely the best way to do this 175 - // tokio::time::sleep(std::time::Duration::from_secs(30)).await; 176 171 }