If set is empty don't select on it

This commit is contained in:
asonix 2023-07-16 14:18:42 -05:00
parent e701ea0e56
commit e9456945d9

View file

@ -357,8 +357,26 @@ where
break 'outer;
}
if set.is_empty() {
if let Some(res) = m.next().await {
match res {
Ok(field) => {
set.spawn_local(handle_stream_field(field, Rc::clone(&form)));
}
Err(e) => {
error = Some(e.into());
continue 'outer;
}
}
} else {
stream_finished = true;
continue 'outer;
}
}
tokio::select! {
opt = m.next() => {
tracing::trace!("Selected stream");
if let Some(res) = opt {
match res {
Ok(field) => {
@ -371,9 +389,11 @@ where
}
} else {
stream_finished = true;
continue 'outer;
}
}
opt = set.join_next() => {
tracing::trace!("Selected set");
if let Some(res) = opt {
let (name_parts, content) = match res {
Ok(Ok(Ok(tup))) => tup,