parallec icon indicating copy to clipboard operation
parallec copied to clipboard

Time out error

Open harjitdotsingh opened this issue 6 years ago • 2 comments

Hi there,

I have this code

 ParallelTask pt = parallelClient.prepareHttpGet("/search/query?q=$QUERY")
                .setHttpHeaders(new ParallecHeader().addPair("x-user", env.getProperty("ifi.user")).addPair("x-password", env.getProperty("ifi.password"))).setProtocol(RequestProtocol.HTTPS)
                .setHttpPort(443)
                .async()
                .setReplaceVarMapToSingleTargetSingleVar("QUERY", queryList, "cdws21.ificlaims.com")
                .setResponseContext(returnMap)
                .execute((res, responseContext) -> {
                    String resourcePath = res.getRequest().getResourcePath();
                    String keyword = resourcePath.substring(resourcePath.lastIndexOf('=') + 1);
                    returnMap.put(keyword, res.getResponseContent());

                });


        while (!pt.isCompleted()) {

            try {
                Thread.sleep(500L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

I see that sometimes we get this error

see this in our parallel request sender [1]__RESP_RECV_IN_MGR 1 (+0) / 1 (100.00%) AFT 14.125 S @ API_0 @ 2018.02.16.15.47.51.239-0500 , TaskID : ded015e3-cae , CODE: NA, RESP_BRIEF: EMPTY , ERR: java.util.concurrent.TimeoutException: No response received after 14000

How can we be notified of the completion of the results. Right now this loop is tight and I don't like it. Is there any way to use Futures and or PRomises ?

harjitdotsingh avatar Feb 16 '18 20:02 harjitdotsingh

will check today

jeffpeiyt avatar Feb 18 '18 03:02 jeffpeiyt

@harjitdotsingh sorry for the late reply.

for the timeout, you can follow http://www.parallec.io/docs/configurations/#timeout . you can change that in the async http client or to update ParallecGlobalConfig.ningFastClientRequestTimeoutMillis = 15000; before start.

you may put the notifying logic in the onComplete function.

if you want to poll the futures, you can take a look at http://www.parallec.io/javadoc/io/parallec/core/ParallelTask.html#getParallelTaskResult-- and poll for http://www.parallec.io/javadoc/io/parallec/core/actor/message/NodeReqResponse.html#singleTaskResponse

jeffpeiyt avatar Feb 24 '18 18:02 jeffpeiyt