Skip to content

Commit

Permalink
small optimization and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dheijl committed Feb 21, 2024
1 parent f005c41 commit ae3c9f4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 40 deletions.
50 changes: 20 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ log = { version = "0.4.20", features = [
] }
once_cell = "1.19.0"
parking_lot = "0.12.1"
serde = { version = "1.0.196", features = ["derive"] }
serde = { version = "1.0.197", features = ["derive"] }
simplelog = "0.12.1"
rand = "0.8.5"
strfmt = "0.2.4"
Expand Down
8 changes: 4 additions & 4 deletions src/bin/swyh-rs-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ fn run_ssdp_updater(ssdp_tx: &Sender<Renderer>, ssdp_interval_mins: f64) {
loop {
let renderers = discover(&rmap, &ui_log).unwrap_or_default();
for r in &renderers {
if !rmap.contains_key(&r.remote_addr) {
rmap.insert(r.remote_addr.clone(), r.clone());
rmap.entry(r.remote_addr.clone()).or_insert_with(|| {
let _ = ssdp_tx.send(r.clone());
thread::yield_now();
info!(
"Found new renderer {} {} at {}",
r.dev_name, r.dev_model, r.remote_addr
);
thread::yield_now();
}
r.clone()
});
}
thread::sleep(Duration::from_millis(
(ssdp_interval_mins * 60.0 * 1000.0) as u64,
Expand Down
10 changes: 5 additions & 5 deletions src/bin/swyh-rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,16 @@ fn run_ssdp_updater(ssdp_tx: &Sender<Renderer>, ssdp_interval_mins: f64) {
loop {
let renderers = discover(&rmap, &ui_log).unwrap_or_default();
for r in &renderers {
if !rmap.contains_key(&r.remote_addr) {
rmap.insert(r.remote_addr.clone(), r.clone());
rmap.entry(r.remote_addr.clone()).or_insert_with(|| {
let _ = ssdp_tx.send(r.clone());
app::awake();
thread::yield_now();
info!(
"Found new renderer {} {} at {}",
r.dev_name, r.dev_model, r.remote_addr
);
app::awake();
thread::yield_now();
}
r.clone()
});
}
thread::sleep(Duration::from_millis(
(ssdp_interval_mins * 60.0 * 1000.0) as u64,
Expand Down

0 comments on commit ae3c9f4

Please sign in to comment.