refactor(tvix/castore/directory/grpc): simplify put_multiple_start a bit
We don't need to be as verbose with the types, we can use Ok::<_,Status> inside the async block. Change-Id: Ibc92a9f7bdbc5031806b7eca82a01e2c7cb48c0a Reviewed-on: https://cl.tvl.fyi/c/depot/+/13264 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
e4999b3a7d
commit
e53adc75bf
1 changed files with 13 additions and 12 deletions
|
|
@ -196,21 +196,22 @@ where
|
|||
|
||||
#[instrument(skip_all)]
|
||||
fn put_multiple_start(&self) -> Box<(dyn DirectoryPutter + 'static)> {
|
||||
let mut grpc_client = self.grpc_client.clone();
|
||||
|
||||
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
let task: JoinHandle<Result<proto::PutDirectoryResponse, Status>> = spawn(
|
||||
async move {
|
||||
let s = grpc_client
|
||||
.put(UnboundedReceiverStream::new(rx))
|
||||
.await?
|
||||
.into_inner();
|
||||
let task = spawn({
|
||||
let mut grpc_client = self.grpc_client.clone();
|
||||
|
||||
Ok(s)
|
||||
} // instrument the task with the current span, this is not done by default
|
||||
.in_current_span(),
|
||||
);
|
||||
async move {
|
||||
Ok::<_, Status>(
|
||||
grpc_client
|
||||
.put(UnboundedReceiverStream::new(rx))
|
||||
.await?
|
||||
.into_inner(),
|
||||
)
|
||||
}
|
||||
// instrument the task with the current span, this is not done by default
|
||||
.in_current_span()
|
||||
});
|
||||
|
||||
Box::new(GRPCPutter {
|
||||
rq: Some((task, tx)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue