Skip to content

Commit

Permalink
feat(configs): use humantime for all durations (100ms, 1s, 5m, 2h, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozwaldorf committed May 21, 2024
1 parent b4f667f commit 0dfc8d0
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4952,6 +4952,16 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"

[[package]]
name = "humantime-serde"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c"
dependencies = [
"humantime",
"serde",
]

[[package]]
name = "hyper"
version = "0.14.28"
Expand Down Expand Up @@ -6300,6 +6310,7 @@ dependencies = [
"futures",
"fxhash",
"hex",
"humantime-serde",
"hyper 0.14.28",
"lightning-blockstore",
"lightning-interfaces",
Expand Down Expand Up @@ -6541,6 +6552,7 @@ dependencies = [
"fleek-crypto",
"fleek-ipld",
"futures",
"humantime-serde",
"hyper 0.14.28",
"hyper-rustls",
"libipld",
Expand Down Expand Up @@ -6568,6 +6580,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"fleek-crypto",
"humantime-serde",
"lightning-application",
"lightning-interfaces",
"lightning-metrics",
Expand Down Expand Up @@ -6596,6 +6609,7 @@ dependencies = [
"fleek-crypto",
"futures",
"hp-fixed",
"humantime-serde",
"lightning-application",
"lightning-interfaces",
"lightning-metrics",
Expand Down Expand Up @@ -6807,6 +6821,7 @@ dependencies = [
"async-channel 2.2.0",
"fleek-crypto",
"futures",
"humantime-serde",
"lightning-interfaces",
"lightning-metrics",
"lightning-utils",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ reqwest = "0.11.18"
serde = { version = "1.0", features = ["derive"] }
serde-big-array = "0.5.1"
serde_json = "1.0.96"
humantime-serde = "1.1.1"
thiserror = "1.0"
tempdir = "0.3"
parking_lot = "0.12.1"
Expand Down
1 change: 1 addition & 0 deletions core/handshake/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn-sdk = { path = "../../lib/sdk" }
tracing.workspace = true
anyhow.workspace = true
serde.workspace = true
humantime-serde.workspace = true
fleek-crypto.workspace = true
async-trait.workspace = true
futures.workspace = true
Expand Down
1 change: 1 addition & 0 deletions core/handshake/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct HandshakeConfig {
/// Optional http configuration
pub https: Option<HttpsConfig>,
/// Timeout for disconnected sessions
#[serde(with = "humantime_serde")]
pub timeout: Duration,
}

Expand Down
1 change: 1 addition & 0 deletions core/origin-ipfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ lightning-interfaces = { path = "../interfaces" }
fleek-ipld.workspace = true
anyhow.workspace = true
serde.workspace = true
humantime-serde.workspace = true
tokio-stream.workspace = true
bytes.workspace = true
cid.workspace = true
Expand Down
1 change: 1 addition & 0 deletions core/origin-ipfs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Config {
pub gateways: Vec<Gateway>,
#[serde(with = "humantime_serde")]
pub gateway_timeout: Duration,
}

Expand Down
1 change: 1 addition & 0 deletions core/pinger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ lightning-metrics = { path = "../metrics" }
tokio.workspace = true
anyhow.workspace = true
serde.workspace = true
humantime-serde.workspace = true
rand.workspace = true
tracing.workspace = true
fleek-crypto.workspace = true
Expand Down
1 change: 1 addition & 0 deletions core/pinger/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct Config {
// /// The number of times that we ping each peer per epoch.
// pub num_pings_per_peer: u16,
/// The interval for sending pings.
#[serde(with = "humantime_serde")]
pub ping_interval: Duration,
}

Expand Down
1 change: 1 addition & 0 deletions core/pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lightning-metrics = { path = "../metrics" }
lightning-utils = { path = "../utils" }
tracing.workspace = true
serde.workspace = true
humantime-serde.workspace = true
tokio.workspace = true
tokio-stream.workspace = true
scc.workspace = true
Expand Down
1 change: 1 addition & 0 deletions core/pool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};

#[derive(Clone, Serialize, Deserialize)]
pub struct Config {
#[serde(with = "humantime_serde")]
pub max_idle_timeout: Duration,
pub address: SocketAddr,
pub http: Option<SocketAddr>,
Expand Down
1 change: 1 addition & 0 deletions core/syncronizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tracing.workspace = true
reqwest.workspace = true
serde_json.workspace = true
serde.workspace = true
humantime-serde.workspace = true
tokio.workspace = true
rand.workspace = true
fleek-crypto.workspace = true
Expand Down
1 change: 1 addition & 0 deletions core/syncronizer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct Config {
#[serde(with = "humantime_serde")]
pub epoch_change_delta: Duration,
}

Expand Down

0 comments on commit 0dfc8d0

Please sign in to comment.