Long running service timeout

42 views
Skip to first unread message

James Hwang

unread,
Apr 16, 2015, 5:04:31 AM4/16/15
to qjsonrpc-d...@googlegroups.com
Hi,

My client program calls a service which takes about 100 seconds to finish.
The service at the server side seems to be running good.
However, my client program times out in the middle (gets .QJsonRpcMessage::Error)

Here comes the client part:

    QJsonRpcMessage request  = QJsonRpcMessage::createRequest("agent.longRunningTask", searchPath);
    QJsonRpcMessage response = m_searchclient->sendMessageBlocking(request);
    if (response.type() == QJsonRpcMessage::Error) {
        qDebugg() << "Failed to RPC to service: " << response.errorData();
        return;
    }

How could I run a long task without timeout?

Thank you very much.

James Hwang

Matt Broadstone

unread,
Apr 16, 2015, 8:15:06 AM4/16/15
to James Hwang, qjsonrpc-d...@googlegroups.com
Hi,

There are two approaches:
1) use the async api of the client to make the request. Use QJsonRpcSocket::sendMessage, and hook up a slot to the resulting QJsonRpcServiceReply's finished() signal.

2) Increase the timeout of the blocking call by specifying a larger number than the default 30000ms (30s) for the sendMessageBlocking method.

Cheers,
M

 
Thank you very much.

James Hwang

--
You received this message because you are subscribed to the Google Groups "qjsonrpc-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qjsonrpc-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Hwang

unread,
Apr 19, 2015, 9:51:42 PM4/19/15
to qjsonrpc-d...@googlegroups.com, james...@aurender.com

Thank Matt for the detail explanations.

James 
 
Reply all
Reply to author
Forward
0 new messages