Skip to content

Commit

Permalink
feat: add max for ratelimit
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Jan 9, 2025
1 parent 9ce4632 commit f15edde
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
]

[workspace.package]
version = "0.2.4"
version = "0.2.5"
authors = ["The Dragonfly Developers"]
homepage = "https://d7y.io/"
repository = "https://github.com/dragonflyoss/client.git"
Expand All @@ -22,13 +22,13 @@ readme = "README.md"
edition = "2021"

[workspace.dependencies]
dragonfly-client = { path = "dragonfly-client", version = "0.2.4" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.4" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.4" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.4" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.4" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.4" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.4" }
dragonfly-client = { path = "dragonfly-client", version = "0.2.5" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.5" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.5" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.5" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.5" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.5" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.5" }
thiserror = "1.0"
dragonfly-api = "=2.1.3"
reqwest = { version = "0.12.4", features = [
Expand Down
5 changes: 5 additions & 0 deletions dragonfly-client/src/resource/piece.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl Piece {
RateLimiter::builder()
.initial(config.download.rate_limit.as_u64() as usize)
.refill(config.download.rate_limit.as_u64() as usize)
.max(MAX_PIECE_LENGTH as usize)
.interval(Duration::from_secs(1))
.fair(false)
.build(),
Expand All @@ -111,14 +112,18 @@ impl Piece {
RateLimiter::builder()
.initial(config.upload.rate_limit.as_u64() as usize)
.refill(config.upload.rate_limit.as_u64() as usize)
.max(MAX_PIECE_LENGTH as usize)
.interval(Duration::from_secs(1))
.fair(false)
.build(),
),
prefetch_rate_limiter: Arc::new(
RateLimiter::builder()
.initial(config.proxy.prefetch_rate_limit.as_u64() as usize)
.refill(config.proxy.prefetch_rate_limit.as_u64() as usize)
.max(MAX_PIECE_LENGTH as usize)
.interval(Duration::from_secs(1))
.fair(false)
.build(),
),
})
Expand Down

0 comments on commit f15edde

Please sign in to comment.