refactor(task): move retry primitives into the task crate

This commit is contained in:
Tunglies
2026-11-30 18:48:04 +08:00
parent 03554601a6
commit 75910b8db8
13 changed files with 69 additions and 69 deletions
+1 -1
View File
@@ -349,7 +349,7 @@ fn stage_core(target: &Path, package: &[u8], version: &str) -> Result<StagedCore
}
fn create_staging_file(directory: &Path, core_name: &OsStr) -> Result<(PathBuf, File)> {
use crate::utils::retry::{RetryError, RetryPolicy, retry_sync};
use clash_verge_task::retry::{RetryError, RetryPolicy, retry_sync};
retry_sync(
RetryPolicy::fixed(
std::num::NonZeroUsize::MIN.saturating_add(31),
+7 -4
View File
@@ -76,8 +76,10 @@ async fn perform_profile_update(
System,
}
let result =
crate::utils::retry::try_strategies(Strategy::Configured, [Strategy::Clash, Strategy::System], |strategy| {
let result = clash_verge_task::retry::try_strategies(
Strategy::Configured,
[Strategy::Clash, Strategy::System],
|strategy| {
let mut options = merged_opt.clone();
async move {
let (name, success, failure) = match strategy {
@@ -125,8 +127,9 @@ async fn perform_profile_update(
}
result
}
})
.await;
},
)
.await;
let last_err = match result {
Ok((strategy, refresh)) => {
// A persistence error must not replay a successful download with another transport.