From 9c1358fe44d368904b2cf75e308444dffefdb3eb Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 18 Dec 2023 10:20:41 +0200 Subject: [PATCH] refactor(tvix/store): remove more clones on pathinfoservice These are still leftovers from before the traits being async, where we had to clone before moving into an async closure. Change-Id: I1b3937edf61ce3e23bb07803306622c37a3572c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10381 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster Autosubmit: flokli --- tvix/store/src/proto/grpc_pathinfoservice_wrapper.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tvix/store/src/proto/grpc_pathinfoservice_wrapper.rs b/tvix/store/src/proto/grpc_pathinfoservice_wrapper.rs index 763261429..06c4b2f1f 100644 --- a/tvix/store/src/proto/grpc_pathinfoservice_wrapper.rs +++ b/tvix/store/src/proto/grpc_pathinfoservice_wrapper.rs @@ -73,8 +73,8 @@ impl proto::path_info_service_server::PathInfoService for GRPCPathInfoServiceWra match request.into_inner().node { None => Err(Status::invalid_argument("no root node sent")), Some(root_node) => { - let path_info_service = self.path_info_service.clone(); - let (nar_size, nar_sha256) = path_info_service + let (nar_size, nar_sha256) = self + .path_info_service .calculate_nar(&root_node) .await .expect("error during nar calculation"); // TODO: handle error @@ -94,10 +94,9 @@ impl proto::path_info_service_server::PathInfoService for GRPCPathInfoServiceWra ) -> Result, Status> { let (tx, rx) = tokio::sync::mpsc::channel(5); - let path_info_service = self.path_info_service.clone(); + let mut stream = self.path_info_service.list(); let _task = task::spawn(async move { - let mut stream = path_info_service.list(); while let Some(e) = stream.next().await { let res = e.map_err(|e| Status::internal(e.to_string())); if tx.send(res).await.is_err() {