mirror of
https://github.com/icewind1991/notify-redis.git
synced 2026-06-04 02:34:13 +02:00
only log events that we push to redis
This commit is contained in:
parent
7d4fefd3d5
commit
5d74cb1485
1 changed files with 7 additions and 7 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -37,19 +37,19 @@ fn watch(path: String, redis_connect: String, redis_list: String) -> Result<(),
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match rx.recv() {
|
match rx.recv() {
|
||||||
Ok(event) => {
|
Ok(event) => push_event(event, &con, &redis_list)?,
|
||||||
println!("{:?}", event);
|
|
||||||
push_event(event, &con, &redis_list)?;
|
|
||||||
}
|
|
||||||
Err(e) => println!("watch error: {:?}", e),
|
Err(e) => println!("watch error: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_event(event: DebouncedEvent, con: &Connection, list: &String) -> RedisResult<u8> {
|
fn push_event(event: DebouncedEvent, con: &Connection, list: &String) -> RedisResult<()> {
|
||||||
match format_event(event) {
|
match format_event(event) {
|
||||||
Some(formatted_event) => con.lpush(list, formatted_event),
|
Some(formatted_event) => {
|
||||||
None => Ok(0)
|
println!("{}", formatted_event);
|
||||||
|
return con.lpush(list, formatted_event);
|
||||||
|
},
|
||||||
|
None => Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue