Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error instead of expect inside msg_encode. #1857

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions crates/re_sdk_comms/src/buffered_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,23 @@ fn msg_encode(
MsgMsg::Flush => PacketMsg::Flush,
};

packet_tx
.send(packet_msg)
.expect("tcp_sender thread should live longer");
// TODO(jleibs): It's not clear why we're hitting this case, but an error here is still better than
// a panic. See: https://github.com/rerun-io/rerun/issues/1855
match packet_tx.send(packet_msg) {
Ok(_) => {},
Err(_) => {
re_log::error!("Failed to send message to tcp_sender thread. Likely a shutdown race-condition.");
},
};

msg_drop_tx.send(msg_msg).expect("Main thread should still be alive");
// TODO(jleibs): It's not clear why we're hitting this case, but an error here is still better than
// a panic. See: https://github.com/rerun-io/rerun/issues/1855
match msg_drop_tx.send(msg_msg) {
Ok(_) => {},
Err(_) => {
re_log::error!("Failed to send message to msg_dropp thread. Likely a shutdown race-condition");
},
};
} else {
return; // channel has closed
}
Expand Down