use sqlx::{Pool, Postgres}; use crate::backfill::backfill; mod backfill; mod config; mod db; mod utils; #[derive(Debug)] struct Error; #[tokio::main] async fn main() -> Result<(), Error> { env_logger::init(); init![ config::USER_DID, config::USER_PDS_URL, config::USER_EXPORT_URL, config::USER_SUBSCRIBE_URL, config::DATABASE_URL ]; println!( "Starting meview: User: {} PDS URL: {} Repo Export URL: {} Subscribe Repos URL: {} Database: {}", config::USER_DID.get().await, config::USER_PDS_URL.get().await, config::USER_EXPORT_URL.get().await, config::USER_SUBSCRIBE_URL.get().await, config::DATABASE_URL.get().await ); let conn: Pool = db::conn().await; println!("Database connected and initialized"); println!("Starting backfill"); let timer = std::time::Instant::now(); backfill(&conn, Some(timer)) .await .unwrap_or_else(|err| panic!("{}", err)); println!("Backfill complete. Took {:?}", timer.elapsed()); println!("Completed sucessfully!"); Ok(()) }