Listening to the shaggs!
This commit is contained in:
1 parent
238cd9f2da
commit
9f86d53d11
9 files changed
+69
-66
No files matched your search
+12
-3
@@ -1,18 +1,20 @@
|
||||
use std::io;
|
||||
use std::time::Duration;
|
||||
|
||||
use rusqlite::Connection;
|
||||
use tokio::time::sleep;
|
||||
|
||||
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<()> {
|
||||
pub async fn event_processor_loop(conn: &mut Connection,
|
||||
r: async_channel::Receiver<Event>) -> CustomResult<()> {
|
||||
loop {
|
||||
let res = r.recv().await;
|
||||
match res {
|
||||
Ok(event) => process_event(conn, event)?, // todo, remove ?
|
||||
Ok(event) => process_event(conn, event)?, // todo, remove "?"
|
||||
Err(e) => {
|
||||
println!("Error: {:?}", e);
|
||||
return Err(FuckingError(e.to_string()));
|
||||
@@ -20,3 +22,10 @@ pub async fn worker_loop(conn: &mut Connection,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn bob() -> CustomResult<()> {
|
||||
loop {
|
||||
sleep(Duration::from_millis(1000)).await;
|
||||
println!("100 ms have elapsed");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user