diff --git a/src/processes/post_indexer.rs b/src/processes/post_indexer.rs index 7fa054c..b55850d 100644 --- a/src/processes/post_indexer.rs +++ b/src/processes/post_indexer.rs @@ -106,7 +106,11 @@ impl CommitProcessor for PostIndexer { self.config.feed_generator_did, commit.seq, commit.time ); self.database - .update_subscription_cursor(Bluesky::FIREHOSE_HOST, &self.config.feed_generator_did, commit.seq) + .update_subscription_cursor( + Bluesky::FIREHOSE_HOST, + &self.config.feed_generator_did, + commit.seq, + ) .await?; } diff --git a/src/processes/profile_classifier.rs b/src/processes/profile_classifier.rs index 8c3d801..530c7ab 100644 --- a/src/processes/profile_classifier.rs +++ b/src/processes/profile_classifier.rs @@ -56,16 +56,18 @@ impl ProfileClassifier { } async fn fill_in_profile_details(&self, did: &str) -> Result<()> { - let details = self.bluesky.fetch_profile_details(did).await.context("Could not fetch profile details")?; + let details = self + .bluesky + .fetch_profile_details(did) + .await + .context("Could not fetch profile details")?; let country = match details { - Some(details) => { - self.ai - .infer_country_of_living(&details.display_name, &details.description) - .await - .context("Could not infer country of living") - ? - } + Some(details) => self + .ai + .infer_country_of_living(&details.display_name, &details.description) + .await + .context("Could not infer country of living")?, None => "xx".to_owned(), }; diff --git a/src/services/bluesky/client.rs b/src/services/bluesky/client.rs index 4ea151a..b6e77c0 100644 --- a/src/services/bluesky/client.rs +++ b/src/services/bluesky/client.rs @@ -1,9 +1,9 @@ use std::matches; use anyhow::{anyhow, Result}; +use atrium_api::agent::{AtpAgent, Session}; use atrium_api::blob::BlobRef; use atrium_api::records::Record; -use atrium_api::agent::{AtpAgent, Session}; use atrium_xrpc::client::reqwest::ReqwestClient; use axum::http::StatusCode; use chrono::Utc; @@ -11,7 +11,7 @@ use futures::StreamExt; use log::error; use tokio_tungstenite::{connect_async, tungstenite}; -use super::entities::{ProfileDetails}; +use super::entities::ProfileDetails; use super::streaming::{handle_message, CommitProcessor}; pub struct Bluesky { @@ -24,7 +24,7 @@ impl Bluesky { pub fn unauthenticated() -> Self { Self { - agent: AtpAgent::new(ReqwestClient::new(Self::XRPC_HOST.to_owned())) + agent: AtpAgent::new(ReqwestClient::new(Self::XRPC_HOST.to_owned())), } } @@ -40,14 +40,7 @@ impl Bluesky { } pub async fn upload_blob(&self, blob: Vec) -> Result { - let result = self - .agent - .api - .com - .atproto - .repo - .upload_blob(blob) - .await?; + let result = self.agent.api.com.atproto.repo.upload_blob(blob).await?; Ok(result.blob) } diff --git a/src/services/database.rs b/src/services/database.rs index d0f9c97..141ae60 100644 --- a/src/services/database.rs +++ b/src/services/database.rs @@ -247,7 +247,12 @@ impl Database { .map(|result| result.rows_affected() > 0)?) } - pub async fn update_subscription_cursor(&self, host: &str, did: &str, cursor: i32) -> Result { + pub async fn update_subscription_cursor( + &self, + host: &str, + did: &str, + cursor: i32, + ) -> Result { let mut params = Parameters::new(); Ok(query(