Going somewhere.

This commit is contained in:
didier amyot committed 2023-02-25 12:04:40 -05:00
1 parent 9f86d53d11
commit 0bbe716d8d
9 files changed
+160 -59

No files matched your search

+5 -4
View File
@@ -6,17 +6,18 @@ use tokio::time::sleep;
use crate::event_processor::process_event;
use crate::events::Event;
use crate::util::CustomResult;
use crate::util::{CustomResult, SQLiteConnectionFactory};
use crate::util::Error::FuckingError;
pub async fn event_processor_loop(conn: &mut Connection,
// todo, all the "?" and handle the exceptions for real
pub async fn event_processor_loop(conFact: SQLiteConnectionFactory,
r: async_channel::Receiver<Event>) -> CustomResult<()> {
loop {
let res = r.recv().await;
let mut conn = conFact.connection()?;
match res {
Ok(event) => process_event(conn, event)?, // todo, remove "?"
Ok(event) => process_event(&mut conn, event)?,
Err(e) => {
println!("Error: {:?}", e);
return Err(FuckingError(e.to_string()));
}
}