Formatting
This commit is contained in:
parent
c0c56627c1
commit
8426bf7c8c
|
@ -106,7 +106,11 @@ impl CommitProcessor for PostIndexer {
|
||||||
self.config.feed_generator_did, commit.seq, commit.time
|
self.config.feed_generator_did, commit.seq, commit.time
|
||||||
);
|
);
|
||||||
self.database
|
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?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,16 +56,18 @@ impl ProfileClassifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fill_in_profile_details(&self, did: &str) -> Result<()> {
|
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 {
|
let country = match details {
|
||||||
Some(details) => {
|
Some(details) => self
|
||||||
self.ai
|
.ai
|
||||||
.infer_country_of_living(&details.display_name, &details.description)
|
.infer_country_of_living(&details.display_name, &details.description)
|
||||||
.await
|
.await
|
||||||
.context("Could not infer country of living")
|
.context("Could not infer country of living")?,
|
||||||
?
|
|
||||||
}
|
|
||||||
None => "xx".to_owned(),
|
None => "xx".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use std::matches;
|
use std::matches;
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
|
use atrium_api::agent::{AtpAgent, Session};
|
||||||
use atrium_api::blob::BlobRef;
|
use atrium_api::blob::BlobRef;
|
||||||
use atrium_api::records::Record;
|
use atrium_api::records::Record;
|
||||||
use atrium_api::agent::{AtpAgent, Session};
|
|
||||||
use atrium_xrpc::client::reqwest::ReqwestClient;
|
use atrium_xrpc::client::reqwest::ReqwestClient;
|
||||||
use axum::http::StatusCode;
|
use axum::http::StatusCode;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
@ -11,7 +11,7 @@ use futures::StreamExt;
|
||||||
use log::error;
|
use log::error;
|
||||||
use tokio_tungstenite::{connect_async, tungstenite};
|
use tokio_tungstenite::{connect_async, tungstenite};
|
||||||
|
|
||||||
use super::entities::{ProfileDetails};
|
use super::entities::ProfileDetails;
|
||||||
use super::streaming::{handle_message, CommitProcessor};
|
use super::streaming::{handle_message, CommitProcessor};
|
||||||
|
|
||||||
pub struct Bluesky {
|
pub struct Bluesky {
|
||||||
|
@ -24,7 +24,7 @@ impl Bluesky {
|
||||||
|
|
||||||
pub fn unauthenticated() -> Self {
|
pub fn unauthenticated() -> Self {
|
||||||
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<u8>) -> Result<BlobRef> {
|
pub async fn upload_blob(&self, blob: Vec<u8>) -> Result<BlobRef> {
|
||||||
let result = self
|
let result = self.agent.api.com.atproto.repo.upload_blob(blob).await?;
|
||||||
.agent
|
|
||||||
.api
|
|
||||||
.com
|
|
||||||
.atproto
|
|
||||||
.repo
|
|
||||||
.upload_blob(blob)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(result.blob)
|
Ok(result.blob)
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,12 @@ impl Database {
|
||||||
.map(|result| result.rows_affected() > 0)?)
|
.map(|result| result.rows_affected() > 0)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_subscription_cursor(&self, host: &str, did: &str, cursor: i32) -> Result<bool> {
|
pub async fn update_subscription_cursor(
|
||||||
|
&self,
|
||||||
|
host: &str,
|
||||||
|
did: &str,
|
||||||
|
cursor: i32,
|
||||||
|
) -> Result<bool> {
|
||||||
let mut params = Parameters::new();
|
let mut params = Parameters::new();
|
||||||
|
|
||||||
Ok(query(
|
Ok(query(
|
||||||
|
|
Loading…
Reference in New Issue