Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
0

Configure Feed

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

wow this is horrible for peek

but it works

+15 -10
+15 -10
ufos/src/storage_fjall.rs
··· 302 302 303 303 // timelies 304 304 let live_counts_range = LiveCountsKey::range_from_cursor(rollup_cursor)?; 305 - let mut timely_iter = self.rollups.range(live_counts_range); 305 + let mut timely_iter = self.rollups.range(live_counts_range).into_iter().peekable(); 306 306 307 - let next_timely = timely_iter 308 - .next() 309 - .transpose()? 310 - .map(|(key_bytes, val_bytes)| { 311 - db_complete::<LiveCountsKey>(&key_bytes).map(|k| (k, val_bytes)) 307 + let timely_next_cursor = timely_iter 308 + .peek_mut() 309 + .map(|kv| -> StorageResult<Cursor> { 310 + match kv { 311 + Err(e) => Err(std::mem::replace(e, fjall::Error::Poisoned))?, 312 + Ok((key_bytes, _)) => { 313 + let key = db_complete::<LiveCountsKey>(&key_bytes)?; 314 + Ok(key.cursor()) 315 + } 316 + } 312 317 }) 313 318 .transpose()?; 314 319 ··· 326 331 }) 327 332 .transpose()?; 328 333 329 - match (next_timely, next_delete) { 330 - (Some((k, timely_val_bytes)), Some((cursor, delete_val_bytes))) => { 331 - if k.cursor() < cursor { 334 + match (timely_next_cursor, next_delete) { 335 + (Some(timely_next_cursor), Some((delete_cursor, delete_val_bytes))) => { 336 + if timely_next_cursor < delete_cursor { 332 337 eprintln!("rollup until delete cursor"); 333 338 } else { 334 339 eprintln!("delete then come back for rollups"); 335 340 } 336 341 } 337 - (Some((k, timely_val_bytes)), None) => { 342 + (Some(timely_next_cursor), None) => { 338 343 eprintln!("do as much rollup as we want"); 339 344 } 340 345 (None, Some((cursor, delete_val_bytes))) => {