feat: add with_capacity for content (#671)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2024-08-15 21:14:58 +08:00 committed by GitHub
parent 9ecc4d2659
commit 94952ae77c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@ members = [
]
[workspace.package]
version = "0.1.100"
version = "0.1.101"
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.1.100" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.100" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.100" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.100" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.100" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.100" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.100" }
dragonfly-client = { path = "dragonfly-client", version = "0.1.101" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.101" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.101" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.101" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.101" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.101" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.101" }
thiserror = "1.0"
dragonfly-api = "2.0.148"
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }

View File

@ -791,7 +791,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler {
})?;
// Read the content of the piece.
let mut content = Vec::new();
let mut content = Vec::with_capacity(piece.length as usize);
reader.read_to_end(&mut content).await.map_err(|err| {
// Collect upload piece failure metrics.
collect_upload_piece_failure_metrics();