how to fix the cannot be shared between threads safely
error in client Streaming proxy?
#2190
-
Hi, I am writing a proxy server using tonic and met the async fn add_artifacts(
&self,
request: Request<tonic::Streaming<AddArtifactsRequest>>,
) -> Result<Response<AddArtifactsResponse>, Status> {
let mut client = Self::connect_to_spark(&request).await?;
let mut stream = request.into_inner();
let mut items = Vec::new();
while let Some(req) = stream.next().await {
items.push(req?);
}
let out_stream = futures::stream::iter(items);
client.add_artifacts(out_stream).await
} The error message is complicated to understand:
|
Beta Was this translation helpful? Give feedback.
Answered by
HaoYang670
Feb 26, 2025
Replies: 1 comment 1 reply
-
seems related to #241, but could anyone point me out how to fix that? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I fixed it by using
futures::executor::block_on