lock only ones

This commit is contained in:
jb-alvarado 2022-05-17 21:45:35 +02:00
parent 536cceca78
commit d02cf98c60
2 changed files with 12 additions and 9 deletions

View File

@ -93,20 +93,21 @@ impl FolderSource {
fn shuffle(&mut self) {
let mut rng = thread_rng();
self.nodes.lock().unwrap().shuffle(&mut rng);
let mut nodes = self.nodes.lock().unwrap();
for (index, item) in self.nodes.lock().unwrap().iter_mut().enumerate() {
nodes.shuffle(&mut rng);
for (index, item) in nodes.iter_mut().enumerate() {
item.index = Some(index);
}
}
fn sort(&mut self) {
self.nodes
.lock()
.unwrap()
.sort_by(|d1, d2| d1.source.cmp(&d2.source));
let mut nodes = self.nodes.lock().unwrap();
for (index, item) in self.nodes.lock().unwrap().iter_mut().enumerate() {
nodes.sort_by(|d1, d2| d1.source.cmp(&d2.source));
for (index, item) in nodes.iter_mut().enumerate() {
item.index = Some(index);
}
}

View File

@ -103,8 +103,10 @@ fn main() {
player(&config, play_control, playout_stat, proc_control);
}
if messages.lock().unwrap().len() > 0 {
send_mail(&config, messages.lock().unwrap().join("\n"));
let msg = messages.lock().unwrap();
if msg.len() > 0 {
send_mail(&config, msg.join("\n"));
}
info!("Playout done...");