Tap drinker
2
fork

Configure Feed

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

fix: do not archive deleted records

Signed-off-by: tjh <x@tjh.dev>

tjh 6d9456ef 4745e9a9

+10 -19
+4
migrations/20260106104725_drop-deleted.down.sql
··· 1 + CREATE TABLE deleted_record ( 2 + LIKE record 3 + INCLUDING all 4 + );
+1
migrations/20260106104725_drop-deleted.up.sql
··· 1 + DROP TABLE deleted_record;
+1 -4
src/main.rs
··· 190 190 .await?; 191 191 } 192 192 RecordAction::Delete => { 193 - query::archive_record(did, collection, rkey) 194 - .execute(&mut **transaction) 195 - .await?; 196 - query::delete_record(did, collection, rkey) 193 + query::delete_record(did, collection, rkey, rev) 197 194 .execute(&mut **transaction) 198 195 .await?; 199 196 }
+3 -14
src/query.rs
··· 1 1 use trap::tap::IdentityStatus; 2 2 3 - pub fn archive_record<'a>( 4 - did: &'a str, 5 - collection: &'a str, 6 - rkey: &'a str, 7 - ) -> sqlx::query::Query<'a, sqlx::Postgres, sqlx::postgres::PgArguments> { 8 - sqlx::query!( 9 - "INSERT INTO deleted_record (SELECT did, collection, rkey, rev, cid, live, data FROM record WHERE (did, collection, rkey) = ($1, $2, $3))", 10 - did, 11 - collection, 12 - rkey, 13 - ) 14 - } 15 - 16 3 pub fn delete_record<'a>( 17 4 did: &'a str, 18 5 collection: &'a str, 19 6 rkey: &'a str, 7 + rev: &'a str, 20 8 ) -> sqlx::query::Query<'a, sqlx::Postgres, sqlx::postgres::PgArguments> { 21 9 sqlx::query!( 22 - "DELETE FROM record WHERE (did, collection, rkey) = ($1, $2, $3)", 10 + "DELETE FROM record WHERE (did, collection, rkey) = ($1, $2, $3) AND rev <= $4", 23 11 did, 24 12 collection, 25 13 rkey, 14 + rev 26 15 ) 27 16 } 28 17
+1 -1
src/tap/channel.rs
··· 11 11 12 12 use crate::tap::{TapClient, TapEvent}; 13 13 14 - const TIMEOUT: Duration = Duration::from_secs(30); 14 + const TIMEOUT: Duration = Duration::from_secs(10); 15 15 16 16 #[derive(Debug, thiserror::Error)] 17 17 #[error("Failed to enqueue acknowledgement for event #{0}")]