this repo has no description
at main 1.1 kB view raw
1use sqlx::{Pool, Postgres}; 2 3use crate::backfill::backfill; 4 5mod backfill; 6mod config; 7mod db; 8mod utils; 9 10#[derive(Debug)] 11struct Error; 12 13#[tokio::main] 14async fn main() -> Result<(), Error> { 15 env_logger::init(); 16 init![ 17 config::USER_DID, 18 config::USER_PDS_URL, 19 config::USER_EXPORT_URL, 20 config::USER_SUBSCRIBE_URL, 21 config::DATABASE_URL 22 ]; 23 println!( 24 "Starting meview: 25 User: {} 26 PDS URL: {} 27 Repo Export URL: {} 28 Subscribe Repos URL: {} 29 Database: {}", 30 config::USER_DID.get().await, 31 config::USER_PDS_URL.get().await, 32 config::USER_EXPORT_URL.get().await, 33 config::USER_SUBSCRIBE_URL.get().await, 34 config::DATABASE_URL.get().await 35 ); 36 let conn: Pool<Postgres> = db::conn().await; 37 println!("Database connected and initialized"); 38 39 println!("Starting backfill"); 40 let timer = std::time::Instant::now(); 41 backfill(&conn, Some(timer)) 42 .await 43 .unwrap_or_else(|err| panic!("{}", err)); 44 45 println!("Backfill complete. Took {:?}", timer.elapsed()); 46 47 println!("Completed sucessfully!"); 48 Ok(()) 49}