Started to implement proper event processing.
This commit is contained in:
1 parent
af11915a52
commit
238cd9f2da
7 files changed
+75
-88
No files matched your search
+13
-5
@@ -1,13 +1,21 @@
|
||||
use std::io;
|
||||
|
||||
pub async fn worker_loop(r: async_channel::Receiver<i32>) -> io::Result<()> {
|
||||
use rusqlite::Connection;
|
||||
|
||||
use crate::event_processor::process_event;
|
||||
use crate::events::Event;
|
||||
use crate::util::CustomResult;
|
||||
use crate::util::Error::FuckingError;
|
||||
|
||||
pub async fn worker_loop(conn: &mut Connection,
|
||||
r: async_channel::Receiver<Event>) -> CustomResult<()> {
|
||||
loop {
|
||||
let x = r.recv().await;
|
||||
match x {
|
||||
Ok(v) => println!("Processed value: {:?}", v),
|
||||
let res = r.recv().await;
|
||||
match res {
|
||||
Ok(event) => process_event(conn, event)?, // todo, remove ?
|
||||
Err(e) => {
|
||||
println!("Error: {:?}", e);
|
||||
return Ok(());
|
||||
return Err(FuckingError(e.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user