Browse Source

这个延迟刚刚好

skyfffire 4 months ago
parent
commit
f1c92051d5
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/main.rs
  2. 2 2
      src/ws_manager.rs

+ 1 - 1
src/main.rs

@@ -124,7 +124,7 @@ pub async fn run_mexc_subscriptions(
     }
 
     let mut symbols: Vec<String> = filtered_map.keys().cloned().collect();
-    // symbols = symbols.iter().take(1).cloned().collect();
+    symbols = symbols.iter().take(1).cloned().collect();
     
     info!("成功获取 {} 个交易对,准备订阅 1 分钟 K 线、深度数据(需要http初始化)...", symbols.len());
     let mut ws_manager = WsManager::new(symbols, filtered_map.clone(), running.clone());

+ 2 - 2
src/ws_manager.rs

@@ -92,7 +92,7 @@ impl WsManager {
                     "symbol": symbol,
                     "limit": 100,
                 });
-                
+
                 let depth_response = rest_client.depth(params).await;
 
                 if let Some(object_map) = depth_response.data.as_object() {
@@ -102,7 +102,7 @@ impl WsManager {
                     info!("The top-level value is not a JSON object:{:?}", serde_json::to_string_pretty(&depth_response.data)?);
                 }
 
-                tokio::time::sleep(Duration::from_millis(20)).await;
+                tokio::time::sleep(Duration::from_millis(200)).await;
             }
 
             info!("正在创建 {:?} 的订阅...", current_batch_symbols);