use crate::event_processor::process_event; use crate::events::Event; use crate::util::Error::FuckingError; use crate::util::{CustomResult, SQLiteConnectionFactory}; // todo, all the "?" and handle the exceptions for real pub async fn event_processor_loop( conn_fact: SQLiteConnectionFactory, r: async_channel::Receiver, ) -> CustomResult<()> { loop { let res = r.recv().await; let mut conn = conn_fact.connection()?; match res { Ok(event) => process_event(&mut conn, event)?, Err(e) => { return Err(FuckingError(e.to_string())); } } } }