Formatting
This commit is contained in:
		
							parent
							
								
									e68fa95b97
								
							
						
					
					
						commit
						6394321599
					
				| 
						 | 
				
			
			@ -30,8 +30,8 @@ pub async fn make_connection_pool() -> Result<ConnectionPool> {
 | 
			
		|||
    // 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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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<Vec<Operation>> {
 | 
			
		|||
 | 
			
		||||
            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 },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue