Skip to content

Commit 3042818

Browse files
committed
reduce CPU load by adding sleep time
1 parent 45bc231 commit 3042818

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/event_handler/debug.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ impl<'a> DebugHandler<'a> {
4545
ui.set_raw_data(message_vec.into());
4646
});
4747
}
48+
} else {
49+
std::thread::sleep(Duration::from_millis(1));
4850
}
49-
std::thread::sleep(Duration::from_millis(1));
5051
}
5152

5253
fn bitrate(&self) -> Option<u32> {

src/event_handler/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'a> Init<'a> {
100100
exit(1);
101101
}
102102
});
103-
std::thread::sleep(Duration::from_micros(50));
103+
std::thread::sleep(Duration::from_millis(50));
104104
}
105105
}
106106
}

src/event_handler/view.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ impl<'a> ViewHandler<'a> {
139139
});
140140
}
141141
}
142+
} else {
143+
std::thread::sleep(Duration::from_millis(1));
142144
}
143145
}
144146
}

0 commit comments

Comments
 (0)