This is part code problem and part architecting Tokio.. or so I think. I have 46 devices I connect to via russh. I then put them into a future as shown below. The russh connections does a netconf get_config followed by a get state. Is russh the wrong library for this scenario or do I just not understand Tokio/async or both? This worked well with just about 10 devices without async. Any help is appreciated.

 if let Err(e) = nc.sshclient.connect().await { let mut vec = messages.lock().await; eprintln!("Could not connect to {:?}: {:?}", ip, e); vec.push(format!("Could not connect to {:?}: {:?}", ip, e)); continue } let messages_clone = messages.clone(); let pool_clone = pool.clone(); let future = get_config( nc, pool_clone, messages_clone, id, uuid ); set.spawn( async move { future }.await); } let mut count = 1; while let Some(result) = set.join_next().await { println!("Completed: {}", count); count = count + 1; } 

1 post - 1 participant

Read full topic