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)]
|
#[instrument(skip_all)]
|
||||||
fn put_multiple_start(&self) -> Box<(dyn DirectoryPutter + 'static)> {
|
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 (tx, rx) = tokio::sync::mpsc::unbounded_channel();
|
||||||
|
|
||||||
let task: JoinHandle<Result<proto::PutDirectoryResponse, Status>> = spawn(
|
let task = spawn({
|
||||||
async move {
|
let mut grpc_client = self.grpc_client.clone();
|
||||||
let s = grpc_client
|
|
||||||
.put(UnboundedReceiverStream::new(rx))
|
|
||||||
.await?
|
|
||||||
.into_inner();
|
|
||||||
|
|
||||||
Ok(s)
|
async move {
|
||||||
} // instrument the task with the current span, this is not done by default
|
Ok::<_, Status>(
|
||||||
.in_current_span(),
|
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 {
|
Box::new(GRPCPutter {
|
||||||
rq: Some((task, tx)),
|
rq: Some((task, tx)),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue