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.

limiting the iteration range doesn't help booooo

+10 -5
+10 -5
ufos/src/store.rs
··· 461 461 rkey: RecordKey, 462 462 ) -> anyhow::Result<usize> { 463 463 let key_prefix_bytes = 464 - ByIdKey::record_prefix(did, collection.clone(), rkey).to_db_bytes()?; 464 + ByIdKey::record_prefix(did.clone(), collection.clone(), rkey.clone()).to_db_bytes()?; 465 + 466 + // put the cursor of the actual deletion event in to prevent prefix iter from touching newer docs 467 + let key_limit = 468 + ByIdKey::new(did, collection.clone(), rkey, cursor.clone()).to_db_bytes()?; 465 469 466 470 let mut items_removed = 0; 467 471 468 - log::trace!("delete_record: iterate over prefix(!)..."); 469 - for (i, pair) in self.partition.prefix(&key_prefix_bytes).enumerate() { 472 + log::trace!("delete_record: iterate over up to current cursor..."); 473 + for (i, pair) in self.partition.range(key_prefix_bytes..key_limit).enumerate() { 470 474 log::trace!("delete_record iter {i}: found"); 471 475 // find all (hopefully 1) 472 476 let (key_bytes, _) = pair?; ··· 474 478 let found_cursor = key.cursor(); 475 479 if found_cursor > cursor { 476 480 // we are *only* allowed to delete records that came before the record delete event 477 - log::trace!("delete_record: found (and ignoring) newer version(s). key: {key:?}"); 478 - break; 481 + // log::trace!("delete_record: found (and ignoring) newer version(s). key: {key:?}"); 482 + panic!("wtf, found newer version than cursor limit we tried to set."); 483 + // break; 479 484 } 480 485 481 486 // remove the by_id entry