this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 3a1ce8e0e4e1e2a5a69cb057d8debe3a19c8dad9 65 lines 1.6 kB view raw
1use crate::backfill::backfill; 2 3mod backfill; 4mod config; 5mod db; 6mod ingest; 7mod utils; 8 9#[derive(Debug)] 10struct Error; 11 12#[tokio::main] 13async fn main() -> Result<(), Error> { 14 env_logger::init(); 15 init![ 16 config::USER_DID, 17 config::USER_PDS_URL, 18 config::USER_EXPORT_URL, 19 config::USER_SUBSCRIBE_URL, 20 config::DATABASE_URL 21 ]; 22 println!( 23 "Starting meview: 24 User: {} 25 PDS URL: {} 26 Repo Export URL: {} 27 Subscribe Repos URL: {} 28 Database: {}", 29 config::USER_DID.get().await, 30 config::USER_PDS_URL.get().await, 31 config::USER_EXPORT_URL.get().await, 32 config::USER_SUBSCRIBE_URL.get().await, 33 config::DATABASE_URL.get().await 34 ); 35 let conn = db::conn().await; 36 println!("Database connected and initialized"); 37 38 let (queue, queue_handle) = ingest::queue().await; 39 40 println!("Starting backfill"); 41 let timer = std::time::Instant::now(); 42 backfill(conn.clone(), Some(timer)) 43 .await 44 .unwrap_or_else(|err| panic!("{}", err)); 45 46 println!("Backfill complete. Took {:?}", timer.elapsed()); 47 48 println!("Completed sucessfully!"); 49 50 // Set up Ctrl-C handler 51 let (tx, rx) = tokio::sync::oneshot::channel(); 52 tokio::spawn(async move { 53 tokio::signal::ctrl_c().await.ok(); 54 let _ = tx.send(()); 55 }); 56 57 println!("Handling new events. Ctrl+C to quit."); 58 let ingest_handle = ingest::ingest(queue, conn.clone()); 59 60 let _ = rx.await; 61 queue_handle.abort(); 62 ingest_handle.abort(); 63 64 Ok(()) 65}