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.

fix(consumer): remove old update_follow_stats function

Mia cb648ee2 ddd37400

+1 -40
+1 -19
consumer/src/indexer/db.rs
··· 1 1 use super::records::{self, AppBskyEmbed}; 2 2 use crate::utils::{blob_ref, empty_str_as_none, strongref_to_parts}; 3 3 use chrono::prelude::*; 4 - use diesel::pg::Pg; 5 4 use diesel::prelude::*; 6 - use diesel::serialize::ToSql; 7 5 use diesel::sql_types::{Array, Nullable, Text, Timestamp}; 8 6 use diesel_async::{AsyncPgConnection, RunQueryDsl}; 9 7 use ipld_core::cid::Cid; ··· 56 54 .execute(conn) 57 55 .await 58 56 } 59 - 60 57 61 58 pub async fn get_repo_info( 62 59 conn: &mut AsyncPgConnection, ··· 131 128 schema::actors::repo_rev.eq(rev), 132 129 schema::actors::repo_cid.eq(cid.to_string()), 133 130 )) 134 - .filter( 135 - schema::actors::did.eq(repo) 136 - ) 131 + .filter(schema::actors::did.eq(repo)) 137 132 .execute(conn) 138 133 .await 139 134 } ··· 191 186 .get_result(conn) 192 187 .await 193 188 .optional() 194 - } 195 - 196 - pub async fn update_follow_stats<T>( 197 - conn: &mut AsyncPgConnection, 198 - subjects: &[T], 199 - ) -> QueryResult<usize> 200 - where 201 - T: ToSql<Text, Pg> + Sync, 202 - { 203 - diesel::sql_query(include_str!("../sql/follow_stats_upsert.sql")) 204 - .bind::<Array<Text>, _>(subjects) 205 - .execute(conn) 206 - .await 207 189 } 208 190 209 191 pub async fn upsert_profile(
-21
consumer/src/sql/follow_stats_upsert.sql
··· 1 - with new_info as ( 2 - SELECT did, coalesce(following, 0) as following, coalesce(followers, 0) as followers 3 - FROM actors 4 - LEFT JOIN (SELECT did, count(*) AS following 5 - FROM follows 6 - GROUP BY 1) fi USING (did) 7 - LEFT JOIN (SELECT subject as did, count(*) AS followers 8 - FROM follows 9 - GROUP BY 1) fe USING (did) 10 - where actors.did = any($1) 11 - ) 12 - merge into follow_stats fs 13 - using new_info ni 14 - on ni.did = fs.did 15 - when matched then 16 - update 17 - set followers=ni.followers, 18 - following=ni.following 19 - when not matched then 20 - insert (did, followers, following) 21 - values (ni.did, ni.followers, ni.following);