tyronbrand/flow.net

Multithread

Closed this issue · 3 comments

Hey,

was just wondering if its possible to run FlowGrpcClient in parallel/multithread? Seemed to have some issues running more threads.

Have a nice day,
UniveX

would you be able to provide some code so that I can reproduce the issue?

I've scrapped the idea, went via another way. But code was quite simple, running FlowScripts in Parallel.ForEachAsync() led to tons of JsonSerializer/Deserializer exceptions, but judging from the raw responses, I received "ResourceExhausted" several times, so I suppose it was a rate limit (even with low MaxDegreeOfParallelism like 3).

Sorry for wasting your time & have a nice day,
UniveX

Glad you resolved your issue.

You could try increasing the "MaxReceiveMessageSize" or even remove the limit by setting it to null.

var grpcClientOptions = new FlowGrpcClientOptions
{
    ServerUrl = Sdk.Client.Grpc.ServerUrl.EmulatorHost,
    GrpcChannelOptions = new GrpcChannelOptions
    {
        MaxReceiveMessageSize = null
    }
};

var grpcClient = new FlowGrpcClient(grpcClientOptions);

Something similar has been reported a few times with the Go SDK https://discord.com/channels/613813861610684416/709804784089301002
Unfortunately, there haven't been many answers.