diff --git a/src/database.rs b/src/database.rs index 0cb4f08..6c3338a 100644 --- a/src/database.rs +++ b/src/database.rs @@ -30,8 +30,8 @@ pub async fn make_connection_pool() -> Result { // TODO: get options from env vars Ok(PgPoolOptions::new() .max_connections(5) - .connect("postgres://postgres:password@localhost/nederlandskie").await?) - + .connect("postgres://postgres:password@localhost/nederlandskie") + .await?) } pub async fn insert_post( @@ -45,7 +45,12 @@ pub async fn insert_post( Ok(query( &insert_into("Post") .columns(("indexed_at", "author_did", "cid", "uri")) - .values([["now()".to_owned(), params.next(), params.next(), params.next()]]) + .values([[ + "now()".to_owned(), + params.next(), + params.next(), + params.next(), + ]]) .to_string(), ) .bind(author_did) diff --git a/src/main.rs b/src/main.rs index fccbe7d..dd266ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,7 @@ impl OperationProcessor for PostSaver { } => { // TODO: Configure this via env vars if !languages.contains("ru") { - return Ok(()) + return Ok(()); } // BlueSky gets confused a lot about Russian vs Ukrainian, so skip posts diff --git a/src/streaming.rs b/src/streaming.rs index fa3aed9..4601c18 100644 --- a/src/streaming.rs +++ b/src/streaming.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; -use async_trait::async_trait; use anyhow::Result; +use async_trait::async_trait; use crate::frames::Frame; use anyhow::anyhow; @@ -84,10 +84,20 @@ async fn extract_operations(commit: &Commit) -> Result> { operations.push(match op.action.as_str() { "create" => Operation::CreatePost { - languages: record.langs.unwrap_or_else(Vec::new).iter().cloned().collect(), + languages: record + .langs + .unwrap_or_else(Vec::new) + .iter() + .cloned() + .collect(), text: record.text, author_did: commit.repo.clone(), - cid: op.cid.ok_or(anyhow!("cid is not present for a post create operation, how is that possible"))?.to_string(), + cid: op + .cid + .ok_or(anyhow!( + "cid is not present for a post create operation, how is that possible" + ))? + .to_string(), uri, }, "delete" => Operation::DeletePost { uri },