fix: 修复全部 medium/low 优先级问题

- cache/daemon: mtime 比较从 f64(secs) 改为 u64(nanos),避免浮点误差丢失变更
- transport: Unix 启动 daemon 前调用 setsid(),使其脱离控制终端防止 SIGHUP
- daemon/mod: 删除对已废弃 watcher 模块的引用
- watcher.rs: 删除全量死代码文件(功能已内联至 daemon/mod.rs)
- query: find_msg_tables 实际按 max_ts 降序排序(原注释有排序但无实现)
- scanner: 移除三平台 scan_memory 中的 dedup_by(search_pattern 已全局去重)
- watch: Windows 平台返回明确错误而非静默失败
- CI: cargo build 增加 --locked 确保使用 Cargo.lock 版本
This commit is contained in:
jackwener
2026-04-16 15:12:33 +08:00
parent 113e1d2907
commit 8bfea8869e
10 changed files with 46 additions and 195 deletions
+10 -10
View File
@@ -1,6 +1,5 @@
pub mod cache;
pub mod query;
pub mod watcher;
pub mod server;
use anyhow::Result;
@@ -108,7 +107,7 @@ async fn run_watcher(
use std::time::Duration;
use crate::ipc::WatchEvent;
let mut last_mtime = 0.0f64;
let mut last_mtime = 0u64;
let mut last_ts: HashMap<String, i64> = HashMap::new();
let mut initialized = false;
@@ -119,11 +118,11 @@ async fn run_watcher(
continue;
}
let wal_mtime = match mtime_f64(&session_wal) {
Some(m) => m,
None => continue,
let wal_mtime = match mtime_nanos(&session_wal) {
0 => continue,
m => m,
};
if (wal_mtime - last_mtime).abs() < 0.001 {
if wal_mtime == last_mtime {
continue;
}
last_mtime = wal_mtime;
@@ -206,10 +205,11 @@ async fn run_watcher(
}
}
fn mtime_f64(path: &std::path::Path) -> Option<f64> {
std::fs::metadata(path).ok()?
.modified().ok()
.map(|t| t.duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_secs_f64())
fn mtime_nanos(path: &std::path::Path) -> u64 {
std::fs::metadata(path)
.and_then(|m| m.modified())
.map(|t| t.duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_nanos() as u64)
.unwrap_or(0)
}
fn decompress_or_str(data: &[u8]) -> String {