Stop using recv_timeout for now

This commit is contained in:
Arne Beer 2019-11-14 02:03:17 +01:00
parent 506234dc1a
commit ef634bda3c

View file

@ -40,14 +40,12 @@ impl TaskHandler {
/// 2. Check whether any tasks just finished
/// 3. Check whether we can spawn new tasks
pub fn run(&mut self) {
let timeout = Duration::from_millis(250);
loop {
self.receive_commands();
self.process_finished();
if self.is_running {
let _res = self.check_new();
}
std::thread::sleep(timeout);
}
}
@ -99,8 +97,12 @@ impl TaskHandler {
}
fn receive_commands(&mut self) {
let timeout = Duration::from_millis(250);
match self.receiver.recv_timeout(timeout) {
let timeout = Duration::from_millis(100);
// Don't use recv_timeout for now, until this bug get's fixed
// https://github.com/rust-lang/rust/issues/39364
//match self.receiver.recv_timeout(timeout) {
std::thread::sleep(timeout);
match self.receiver.try_recv() {
Ok(message) => info!("{:?}", message),
Err(_) => {},
};