xmlrpc icon indicating copy to clipboard operation
xmlrpc copied to clipboard

Multithreaded usage : requests are not sent

Open Sunslash opened this issue 3 years ago • 1 comments

I am trying to send multiple parallel requests to a Xml-RPC in order to reduce the response time.

The proper way to do it would be to use system.multicall, but this library does not seem to support it.

What I did is start two async tasks and wait for both calls to be completed, something like ` var newStatusTask = Task.Run(() => { return _com.GetStatusStd(); }) ; var newCounterTask = Task.Run(() => { return _com.GetInternalCounters(); }) ;

        var newStatusXml = await newStatusTask;
        var newCountersXml = await newCounterTask;

`

This mostly work, but sometimes one of the requests is not sent at all and leads to a timeout. I confirmed this with Wireshark and looping over both calls every 300ms.

If I wait for the first request to be completed before sending the second one, everything works fine. However for this application the additional ~100ms required to do this could reduce the overall performance.

Is there a proper way to handle parallel xml-rpc calls ?

Sunslash avatar Jul 13 '20 13:07 Sunslash