|
|
@@ -144,14 +144,17 @@ pub async fn init(params: Params,
|
|
|
// 计算需要等待的时间
|
|
|
let wait_duration = next_hour - now;
|
|
|
let wait_secs = wait_duration.num_seconds() as u64;
|
|
|
-
|
|
|
-
|
|
|
- // 等待到下一个整点
|
|
|
- sleep_until(Instant::now() + std::time::Duration::from_secs(wait_secs)).await;
|
|
|
-
|
|
|
+
|
|
|
+ if wait_secs > 0 {
|
|
|
+ sleep_until(Instant::now() + Duration::from_secs(wait_secs)).await;
|
|
|
+ }
|
|
|
+
|
|
|
// 更新近7天的交易量统计
|
|
|
let mut core = trade_volume_core_arc.lock().await;
|
|
|
core.update_trade_volume().await;
|
|
|
+
|
|
|
+ // 等待一分钟以避免过快地循环
|
|
|
+ sleep_until(Instant::now() + Duration::from_secs(60)).await;
|
|
|
}
|
|
|
});
|
|
|
|