+11
-1
src/app.rs
+11
-1
src/app.rs
···
429
429
}
430
430
}
431
431
432
-
while event::poll(Duration::from_millis(0)).unwrap() {
432
+
let timeout_duration = if self.graph.pause {
433
+
// reduce checks to only every 100 milliseconds (~10
434
+
// times a second). This helps reduce spinning of the
435
+
// thread and thus consuming a lot of resources while
436
+
// allowing for event handling at a decent rate.
437
+
Duration::from_millis(100)
438
+
} else {
439
+
Duration::from_millis(0)
440
+
};
441
+
442
+
while event::poll(timeout_duration).unwrap() {
433
443
// process all enqueued events
434
444
let event = event::read().unwrap();
435
445