feat(dragonfly-client-config): change the default value oft the schedule_timeout (#1138)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2025-05-08 22:49:50 +08:00 committed by GitHub
parent 7e46bff143
commit 23efe2cb04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 47 additions and 20 deletions

16
Cargo.lock generated
View File

@ -953,7 +953,7 @@ dependencies = [
[[package]]
name = "dragonfly-client"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"anyhow",
"bytes",
@ -1022,7 +1022,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-backend"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"dragonfly-api",
"dragonfly-client-core",
@ -1053,7 +1053,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-config"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"bytesize",
"bytesize-serde",
@ -1081,7 +1081,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-core"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"headers 0.4.0",
"hyper 1.6.0",
@ -1099,7 +1099,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-init"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"anyhow",
"clap",
@ -1117,7 +1117,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-storage"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"bincode",
"bytes",
@ -1145,7 +1145,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-util"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"base64 0.22.1",
"bytesize",
@ -1560,7 +1560,7 @@ dependencies = [
[[package]]
name = "hdfs"
version = "0.2.26"
version = "0.2.27"
dependencies = [
"dragonfly-client-backend",
"dragonfly-client-core",

View File

@ -12,7 +12,7 @@ members = [
]
[workspace.package]
version = "0.2.26"
version = "0.2.27"
authors = ["The Dragonfly Developers"]
homepage = "https://d7y.io/"
repository = "https://github.com/dragonflyoss/client.git"
@ -22,13 +22,13 @@ readme = "README.md"
edition = "2021"
[workspace.dependencies]
dragonfly-client = { path = "dragonfly-client", version = "0.2.26" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.26" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.26" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.26" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.26" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.26" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.26" }
dragonfly-client = { path = "dragonfly-client", version = "0.2.27" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.27" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.27" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.27" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.27" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.27" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.27" }
dragonfly-api = "=2.1.39"
thiserror = "1.0"
futures = "0.3.31"

View File

@ -143,7 +143,7 @@ fn default_download_rate_limit() -> ByteSize {
/// default_download_piece_timeout is the default timeout for downloading a piece from source.
#[inline]
fn default_download_piece_timeout() -> Duration {
Duration::from_secs(15)
Duration::from_secs(60)
}
/// default_download_concurrent_piece_count is the default number of concurrent pieces to download.
@ -167,7 +167,7 @@ fn default_scheduler_announce_interval() -> Duration {
/// default_scheduler_schedule_timeout is the default timeout for scheduling.
#[inline]
fn default_scheduler_schedule_timeout() -> Duration {
Duration::from_secs(180)
Duration::from_secs(3 * 60 * 60)
}
/// default_dynconfig_refresh_interval is the default interval to refresh dynamic configuration from manager.
@ -743,8 +743,35 @@ pub struct Scheduler {
)]
pub announce_interval: Duration,
/// schedule_timeout is the timeout for scheduling. If the scheduling timeout, dfdaemon will back-to-source
/// download if enable_back_to_source is true, otherwise dfdaemon will return download failed.
/// schedule_timeout is timeout for the scheduler to respond to a scheduling request from dfdaemon, default is 3 hours.
///
/// If the scheduler's response time for a scheduling decision exceeds this timeout,
/// dfdaemon will encounter a `TokioStreamElapsed(Elapsed(()))` error.
///
/// Behavior upon timeout:
/// - If `enable_back_to_source` is `true`, dfdaemon will attempt to download directly
/// from the source.
/// - Otherwise (if `enable_back_to_source` is `false`), dfdaemon will report a download failure.
///
/// **Important Considerations Regarding Timeout Triggers**:
/// This timeout isn't solely for the scheduler's direct response. It can also be triggered
/// if the overall duration of the client's interaction with the scheduler for a task
/// (e.g., client downloading initial pieces and reporting their status back to the scheduler)
/// exceeds `schedule_timeout`. During such client-side processing and reporting,
/// the scheduler might be awaiting these updates before sending its comprehensive
/// scheduling response, and this entire period is subject to the `schedule_timeout`.
///
/// **Configuration Guidance**:
/// To prevent premature timeouts, `schedule_timeout` should be configured to a value
/// greater than the maximum expected time for the *entire scheduling interaction*.
/// This includes:
/// 1. The scheduler's own processing and response time.
/// 2. The time taken by the client to download any initial pieces and download all pieces finished,
/// as this communication is part of the scheduling phase.
///
/// Setting this value too low can lead to `TokioStreamElapsed` errors even if the
/// network and scheduler are functioning correctly but the combined interaction time
/// is longer than the configured timeout.
#[serde(
default = "default_scheduler_schedule_timeout",
with = "humantime_serde"