Skip to content

Commit

Permalink
Add indexes and properly store quoteUris for mediaquotes
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyfraser committed Dec 8, 2024
1 parent 261eb68 commit 5554d30
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rsky-feedgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsky-feedgen"
version = "1.0.1"
version = "1.0.2"
authors = ["Rudy Fraser <[email protected]>"]
description = "A framework for building AT Protocol feed generators, in Rust."
license = "Apache-2.0"
Expand Down
3 changes: 3 additions & 0 deletions rsky-feedgen/migrations/2024-12-01-074204_021/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
DROP INDEX IF EXISTS idx_like_subjecturi_indexedat;
DROP INDEX IF EXISTS idx_post_createdAt_cid;
4 changes: 4 additions & 0 deletions rsky-feedgen/migrations/2024-12-01-074204_021/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Your SQL goes here
CREATE INDEX idx_like_subjecturi_indexedat ON public.like ("subjectUri", "indexedAt");
CREATE INDEX idx_post_createdAt_cid ON "post" ("createdAt" DESC, "cid" DESC)
WHERE "replyParent" IS NULL AND "replyRoot" IS NULL;
3 changes: 2 additions & 1 deletion rsky-feedgen/src/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ pub async fn get_blacksky_trending(
connection: ReadReplicaConn,
config: &State<FeedGenConfig>,
) -> Result<AlgoResponse, ValidationErrorMessageResponse> {
use std::env;
let trending_percentile_min = config.trending_percentile_min.clone();

let params_cursor = match params_cursor {
Expand Down Expand Up @@ -610,6 +609,8 @@ pub async fn queue_creation(
};
}
Embeds::RecordWithMedia(e) => {
new_post.quote_cid = Some(e.record.record.cid);
new_post.quote_uri = Some(e.record.record.uri);
match e.media {
MediaUnion::Images(m) => {
for image in m.images {
Expand Down

0 comments on commit 5554d30

Please sign in to comment.