|
@@ -16,7 +16,7 @@ const SECRET_KEY: &str = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
//ws-订阅公共频道信息
|
|
//ws-订阅公共频道信息
|
|
|
-#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
|
|
+#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
|
|
|
async fn ws_custom_subscribe() {
|
|
async fn ws_custom_subscribe() {
|
|
|
global::log_utils::init_log_with_trace();
|
|
global::log_utils::init_log_with_trace();
|
|
|
|
|
|
|
@@ -46,19 +46,21 @@ async fn ws_custom_subscribe() {
|
|
|
trace!("线程-数据读取-开启");
|
|
trace!("线程-数据读取-开启");
|
|
|
loop {
|
|
loop {
|
|
|
if let Some(data) = read_rx.next().await {
|
|
if let Some(data) = read_rx.next().await {
|
|
|
- let mut trace_stack = TraceStack::default();
|
|
|
|
|
- trace_stack.on_after_network(data.time);
|
|
|
|
|
- trace_stack.on_before_unlock_quant();
|
|
|
|
|
-
|
|
|
|
|
- if data.time != 0 {
|
|
|
|
|
- info!("bian>{}", trace_stack.to_string());
|
|
|
|
|
|
|
+ tokio::spawn(async move {
|
|
|
|
|
+ let mut trace_stack = TraceStack::default();
|
|
|
|
|
+ trace_stack.on_before_unlock_quant();
|
|
|
|
|
+ trace_stack.on_after_network(data.time);
|
|
|
|
|
+
|
|
|
|
|
+ if data.time != 0 {
|
|
|
|
|
+ info!("bian>{}", trace_stack.to_string());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 从通道中接收并丢弃所有的消息,直到通道为空
|
|
|
|
|
+ while let Ok(Some(_)) = read_rx.try_next() {
|
|
|
|
|
+ // 消息被忽略
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 从通道中接收并丢弃所有的消息,直到通道为空
|
|
|
|
|
- while let Ok(Some(_)) = read_rx.try_next() {
|
|
|
|
|
- // 消息被忽略
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
// trace!("线程-数据读取-结束");
|
|
// trace!("线程-数据读取-结束");
|
|
|
});
|
|
});
|