Browse and listen to thousands of radio stations across the globe right from your terminal ๐ŸŒŽ ๐Ÿ“ป ๐ŸŽตโœจ
radio rust tokio web-radio command-line-tool tui

app: App: run(): prevent spinning of thread when paused

If thread is not put to sleep, it would spin continuously and thus
consume a lot of resources. This prevents that.

Changed files
+11 -1
src
+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