Parakeet is a Rust-based Bluesky AppServer aiming to implement most of the functionality required to support the Bluesky client
appview atproto bluesky rust appserver
66
fork

Configure Feed

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

feat(consumer): trigger backfill on empty accounts coming out of deactivated states

fixes #22

Mia d93a4443 5ce5276e

+32
+13
consumer/src/indexer/db.rs
··· 105 105 .optional() 106 106 } 107 107 108 + pub async fn account_status_and_rev( 109 + conn: &mut AsyncPgConnection, 110 + did: &str, 111 + ) -> QueryResult<Option<(types::ActorStatus, Option<String>)>> { 112 + schema::actors::table 113 + .select((schema::actors::status, schema::actors::repo_rev)) 114 + .for_update() 115 + .find(did) 116 + .get_result(conn) 117 + .await 118 + .optional() 119 + } 120 + 108 121 /// Attempts to update a repo to the given version. 109 122 /// returns false if the repo doesn't exist or is too new, or true if the update succeeded. 110 123 pub async fn update_repo_version(
+19
consumer/src/indexer/mod.rs
··· 238 238 .map(ActorStatus::from) 239 239 .unwrap_or(ActorStatus::Active); 240 240 241 + let trigger_bf = if state.do_backfill && status == ActorStatus::Active { 242 + // check old status - if they exist (Some(*)), AND were previously != Active but not Deleted, 243 + // AND have a rev == null, then trigger backfill. 244 + db::account_status_and_rev(conn, &account.did) 245 + .await? 246 + .is_some_and(|(old_status, old_rev)| { 247 + old_rev.is_none() 248 + && old_status != ActorStatus::Active 249 + && old_status != ActorStatus::Deleted 250 + }) 251 + } else { 252 + false 253 + }; 254 + 241 255 let sync_state = (!state.do_backfill).then_some(ActorSyncState::Synced); 242 256 243 257 db::upsert_actor( ··· 249 263 account.time, 250 264 ) 251 265 .await?; 266 + 267 + if trigger_bf { 268 + tracing::debug!("triggering backfill due to account coming out of inactive state"); 269 + db::write_backfill_job(conn, &account.did).await?; 270 + } 252 271 253 272 Ok(()) 254 273 }