Skip to content

Commit b7a655d

Browse files
authored
refactor(grpc, resource): reduce mpsc channel size to 4 (#1513)
* refactor(grpc, resource): reduce mpsc channel size to 8 Signed-off-by: Gaius <gaius.qi@gmail.com> * chore(deps): update dragonfly-client versions to 1.1.7 Signed-off-by: Gaius <gaius.qi@gmail.com> --------- Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent 20517ab commit b7a655d

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = [
1313
]
1414

1515
[workspace.package]
16-
version = "1.1.6"
16+
version = "1.1.7"
1717
authors = ["The Dragonfly Developers"]
1818
homepage = "https://d7y.io/"
1919
repository = "https://github.com/dragonflyoss/client.git"
@@ -23,14 +23,14 @@ readme = "README.md"
2323
edition = "2021"
2424

2525
[workspace.dependencies]
26-
dragonfly-client = { path = "dragonfly-client", version = "1.1.6" }
27-
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.1.6" }
28-
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.1.6" }
29-
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.1.6" }
30-
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.1.6" }
31-
dragonfly-client-metric = { path = "dragonfly-client-metric", version = "1.1.6" }
32-
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.1.6" }
33-
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.1.6" }
26+
dragonfly-client = { path = "dragonfly-client", version = "1.1.7" }
27+
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.1.7" }
28+
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.1.7" }
29+
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.1.7" }
30+
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.1.7" }
31+
dragonfly-client-metric = { path = "dragonfly-client-metric", version = "1.1.7" }
32+
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.1.7" }
33+
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.1.7" }
3434
dragonfly-api = "=2.1.87"
3535
thiserror = "2.0"
3636
futures = "0.3.31"

dragonfly-client/src/grpc/dfdaemon_download.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl DfdaemonDownload for DfdaemonDownloadServerHandler {
415415
let download_clone = download.clone();
416416
let task_manager_clone = self.task.clone();
417417
let task_clone = task.clone();
418-
let (out_stream_tx, out_stream_rx) = mpsc::channel(16);
418+
let (out_stream_tx, out_stream_rx) = mpsc::channel(4);
419419

420420
// Define the error handler to send the error to the stream.
421421
async fn handle_error(
@@ -1026,7 +1026,7 @@ impl DfdaemonDownload for DfdaemonDownloadServerHandler {
10261026
let request_clone = request.clone();
10271027
let task_manager_clone = self.persistent_cache_task.clone();
10281028
let task_clone = task.clone();
1029-
let (out_stream_tx, out_stream_rx) = mpsc::channel(16);
1029+
let (out_stream_tx, out_stream_rx) = mpsc::channel(4);
10301030

10311031
// Define the error handler to send the error to the stream.
10321032
async fn handle_error(

dragonfly-client/src/grpc/dfdaemon_upload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler {
410410
let download_clone = download.clone();
411411
let task_manager_clone = self.task.clone();
412412
let task_clone = task.clone();
413-
let (out_stream_tx, out_stream_rx) = mpsc::channel(16);
413+
let (out_stream_tx, out_stream_rx) = mpsc::channel(4);
414414

415415
// Define the error handler to send the error to the stream.
416416
async fn handle_error(
@@ -1375,7 +1375,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler {
13751375
let request_clone = request.clone();
13761376
let task_manager_clone = self.persistent_cache_task.clone();
13771377
let task_clone = task.clone();
1378-
let (out_stream_tx, out_stream_rx) = mpsc::channel(16);
1378+
let (out_stream_tx, out_stream_rx) = mpsc::channel(4);
13791379

13801380
// Define the error handler to send the error to the stream.
13811381
async fn handle_error(

dragonfly-client/src/proxy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ async fn proxy_via_dfdaemon(
767767
};
768768

769769
// Write the status code to the writer.
770-
let (sender, mut receiver) = mpsc::channel(8);
770+
let (sender, mut receiver) = mpsc::channel(4);
771771

772772
// Get the read buffer size from the config.
773773
let read_buffer_size = config.proxy.read_buffer_size;

dragonfly-client/src/resource/persistent_cache_task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ impl PersistentCacheTask {
822822
let mut finished_pieces: Vec<metadata::Piece> = Vec::new();
823823

824824
// Initialize stream channel.
825-
let (in_stream_tx, in_stream_rx) = mpsc::channel(16);
825+
let (in_stream_tx, in_stream_rx) = mpsc::channel(4);
826826

827827
// Send the register peer request.
828828
in_stream_tx

dragonfly-client/src/resource/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl Task {
568568
let mut finished_pieces: Vec<metadata::Piece> = Vec::new();
569569

570570
// Initialize stream channel.
571-
let (in_stream_tx, in_stream_rx) = mpsc::channel(16);
571+
let (in_stream_tx, in_stream_rx) = mpsc::channel(4);
572572

573573
// Send the register peer request.
574574
in_stream_tx

0 commit comments

Comments
 (0)