mirror of
https://github.com/nimbold/Firelink.git
synced 2026-07-26 12:08:27 +00:00
fix(queue): preserve aria2 connection pool
This commit is contained in:
@@ -2395,6 +2395,7 @@ pub struct ProductionSpawner {
|
||||
}
|
||||
|
||||
const ARIA2_MIN_SPLIT_SIZE: &str = "1M";
|
||||
const ARIA2_STREAM_PIECE_SELECTOR: &str = "inorder";
|
||||
|
||||
fn apply_aria2_connection_options(
|
||||
options: &mut serde_json::Map<String, serde_json::Value>,
|
||||
@@ -2416,6 +2417,14 @@ fn apply_aria2_connection_options(
|
||||
"min-split-size".to_string(),
|
||||
serde_json::json!(ARIA2_MIN_SPLIT_SIZE),
|
||||
);
|
||||
// Aria2's default selector deliberately reduces the number of established
|
||||
// connections over time. Keep a segmented HTTP transfer replenishing its
|
||||
// requested ranges so a healthy host does not degrade from (for example)
|
||||
// 16 active connections to one or two after early pieces finish.
|
||||
options.insert(
|
||||
"stream-piece-selector".to_string(),
|
||||
serde_json::json!(ARIA2_STREAM_PIECE_SELECTOR),
|
||||
);
|
||||
}
|
||||
|
||||
impl ProductionSpawner {
|
||||
@@ -2808,6 +2817,10 @@ mod tests {
|
||||
options.get("min-split-size"),
|
||||
Some(&serde_json::json!("1M"))
|
||||
);
|
||||
assert_eq!(
|
||||
options.get("stream-piece-selector"),
|
||||
Some(&serde_json::json!("inorder"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user