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 <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-12-18 10:20:41 +02:00 committed by clbot
parent 0ae32d45f6
commit 9c1358fe44

View file

@ -73,8 +73,8 @@ impl proto::path_info_service_server::PathInfoService for GRPCPathInfoServiceWra
match request.into_inner().node { match request.into_inner().node {
None => Err(Status::invalid_argument("no root node sent")), None => Err(Status::invalid_argument("no root node sent")),
Some(root_node) => { Some(root_node) => {
let path_info_service = self.path_info_service.clone(); let (nar_size, nar_sha256) = self
let (nar_size, nar_sha256) = path_info_service .path_info_service
.calculate_nar(&root_node) .calculate_nar(&root_node)
.await .await
.expect("error during nar calculation"); // TODO: handle error .expect("error during nar calculation"); // TODO: handle error
@ -94,10 +94,9 @@ impl proto::path_info_service_server::PathInfoService for GRPCPathInfoServiceWra
) -> Result<Response<Self::ListStream>, Status> { ) -> Result<Response<Self::ListStream>, Status> {
let (tx, rx) = tokio::sync::mpsc::channel(5); 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 _task = task::spawn(async move {
let mut stream = path_info_service.list();
while let Some(e) = stream.next().await { while let Some(e) = stream.next().await {
let res = e.map_err(|e| Status::internal(e.to_string())); let res = e.map_err(|e| Status::internal(e.to_string()));
if tx.send(res).await.is_err() { if tx.send(res).await.is_err() {