重构上传

This commit is contained in:
2026-10-29 14:39:14 +08:00
parent 5739f7f8e7
commit 0cf352cabb
19 changed files with 1398 additions and 190 deletions
+11 -1
View File
@@ -374,12 +374,17 @@ pub struct StepSpec {
pub path: String,
#[serde(rename = "savePath")]
pub save_path: String,
/// 持续运行:命中后不摘除 waiter,同类型的包可以反复抓
#[serde(default)]
pub repeat: bool,
}
#[derive(Clone)]
pub struct Waiter {
pub id: String,
pub path: Regex,
pub save_path: String,
pub repeat: bool,
}
pub type Waiters = Arc<StdMutex<Vec<Waiter>>>;
@@ -387,7 +392,12 @@ pub type Waiters = Arc<StdMutex<Vec<Waiter>>>;
fn take_matching_waiter(waiters: &StdMutex<Vec<Waiter>>, path_and_query: &str) -> Option<Waiter> {
let mut list = waiters.lock().unwrap();
let idx = list.iter().position(|w| w.path.is_match(path_and_query))?;
Some(list.remove(idx))
if list[idx].repeat {
// 持续运行:保留 waiter,让后续同类型的请求继续命中
Some(list[idx].clone())
} else {
Some(list.remove(idx))
}
}
#[derive(Clone, Debug)]