only send chat clear after a msg

This commit is contained in:
ntr 2019-10-18 17:21:01 +11:00
parent ff48288ae2
commit d1866a4fda
2 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,6 @@
use std::collections::{HashMap, HashSet};
use std::thread::{spawn, sleep};
use std::time;
// Db Commons
use uuid::Uuid;
@ -314,6 +316,12 @@ impl Events {
}
c.chat = Some((instance, msg));
let events_tx = self.tx.clone();
spawn(move || {
sleep(time::Duration::from_secs(3));
events_tx.send(Event::ChatClear(id, instance)).unwrap();
});
}
// now collect all listeners of this instance

View File

@ -179,13 +179,6 @@ impl Connection {
return Err(err_msg("invalid chat index"));
}
let events_tx = self.events.clone();
let id = self.id;
spawn(move || {
sleep(time::Duration::from_secs(3));
events_tx.send(Event::ChatClear(id, instance_id)).unwrap();
});
Ok(RpcMessage::Processing(()))
},
_ => {