enable retry from git path

Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
Pakin 2026-03-06 16:21:31 +07:00
parent b1d9cde9c8
commit a5c883dbe6

View file

@ -369,13 +369,15 @@ async fn read(
.await;
}
Err(_) => {
let lvc = latest_version.clone();
// concurrent fetch
for i in 1..5 {
let latest_version_c = lvc.clone();
retry_cnt = i;
// retry #1: get from redis
let r1_key = get_key_cache(
recipe_param.country.clone(),
latest_version.to_string(),
recipe_param.clone().country,
latest_version_c.clone(),
is_req_patch(&recipe_param),
retry_cnt,
);
@ -412,6 +414,25 @@ async fn read(
}
} else {
// retry get from git
let content =
match invoke_checkout_request(config.clone(), r1_key)
.await
{
Ok(file_content) => file_content,
Err(e) => {
println!("Error on checkout: {e}");
"".to_string()
}
};
let recipe: Recipe = serde_json::from_str(&content)?;
throttle_send_recipe(
&recipe,
&tx,
recipe_param.clone().country,
latest_version_c.clone(),
)
.await;
}
}
}