MCPcopy Create free account
hub / github.com/RustOtomeLab/RustEng / try_send_loop

Function try_send_loop

src/executors/delay_executor.rs:74–90  ·  view source on GitHub ↗
(tx: &Sender<Command>, cmd: Command)

Source from the content-addressed store, hash-verified

72}
73
74fn try_send_loop(tx: &Sender<Command>, cmd: Command) {
75 match tx.try_send(cmd) {
76 Ok(_) => {}
77 Err(tokio::sync::mpsc::error::TrySendError::Full(cmd)) => {
78 // 通道满了:把发送任务交给 tokio 等待
79 let tx_clone = tx.clone();
80 tokio::spawn(async move {
81 if let Err(e) = tx_clone.send(cmd).await {
82 eprintln!("delay tx send failed: {e:?}");
83 }
84 });
85 }
86 Err(e) => {
87 eprintln!("try_send other error: {e:?}");
88 }
89 }
90}
91
92pub(crate) struct DelayExecutor {
93 timer: slint::Timer,

Callers 1

send_loopMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected