Increasing WS Promise timeout - rest

I'm calling a REST ws that takes more time than 5 seconds and I'm getting a timeout for the Promise response. How can I increase this time above 5 seconds?

You can pass a Long to the get method of the promise that corresponds to the timeout of this method. For example:
promise.get(120000L);
would set a 2 minutes timeout for the get method.

Related

Automatic heart-beat of Cadence workflow/activity

We have registered the activities with auto-heartbeat configuration EnableAutoHeartBeat: true and also configured the activity option config HeartbeatTimeout: 15Min in the activity implementation.
Do we still need to explicitly send heart-beat using activity.heartbeat() or is it automatically taken care by the go-client library?
If its automatic, then what will happen if the Activity is waiting for external API response say >15Min delay?
What will happen during the activity heart-beat if the worker executing the activity crashes or killed?
Will Cadence retry the activities due to heart-beat failures?
No, the SDK will take care of it with this config.
The auto heartbeat will send heartbeat for every interval — the interval is 80% * Heartbeat timeout(15 minutes in your case) so that the activity won’t get timeout as long as the activity worker is still live.
So you should use a smaller heatbeat timeout, ideally 10~20s is the best.
The activity will fail with “heartbeat timeout “
Yes if you have set a retry policy .
See my other answer for retry policy
How to set proper timeout values for Cadence activities(local and regular activities, with or without retry)?
Example
Let say your activity implementation is waiting on AWS SDK API for 2 hours (max API timeout configured) --
You should still use 10-20 s for heartbeat timeout, and also use 2 hours for activity start to close timeout.
Heartbeat timeout is for detecting the host is not live anymore so that the activity can be restarted as early as possible.
Imagine this case:
Because the API takes 2 hours, the activity worker got restarted during the 2 hours.
If the HB timeout is 15 minutes, then Cadence will retry this activity after 15 minutes.
If HB timeout is 10s, then Cadence can retry it after 10s, because it will get HB timeout within 10 seconds.

Gatling Scenario Response time

I am doing load test for an api which average response time is 5 sec
in my script i setup constantUserPerSecond 2 and duration 150 second
.inject(constantUsersPerSec(2) during (150 seconds)),
will it generate 2 request per second ? or less , because of 1 request will take 5 second to complete ?
constantUsersPerSec(2) will start a new user executing the scenario every .5 seconds or so. For this sort of injection profile gatling doesn't take into consideration how long it takes for a request to complete.

Async Timeout Interval Error in Protractor

I am working on protractor and I am using jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000; and also browser.sleep(10000); for giving time to page to load. But sometimes it works and some times it give me error as :
Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
I have tried several functions also but its not the permanent solution in my case. Can someone help me in getting the proper and permanent solution to test the end to end flow.
Thanks in advance.
The timeout you get only indicates, that your it- and/or describe-block hasn't finished within timeout limit (100 sec, if I saw right).
Your browser.sleep(10000) alone uses 10% of your available maximum test execution time.
Try to either increase your default timeout to something bigger like 300000 (5 min.) and/or reduce your browser.sleep() times to only what's necessary.

HttpUrlConnection taking exactly 2 minutes for timeout

Whenever the URL is trying to load, it takes larger than the time set in the connection timeout, but setting the connection timeout to 20 seconds does not work it happens only after 2 minutes, and also whatever the time that is set in the connection time out, its taking exactly 2 minutes for the server to connection time out.
URL urlConnect = new URL(url.toString());
HttpURLConnection urlc = (HttpURLConnection) urlConnect.openConnection();
urlc.setDoInput(true);
urlc.setConnectTimeout(1000 * 20); // Timeout is in MILLI seconds
urlc.connect();
Or whether the 2 minutes is the default values for timeout? how to set the timeout to exactly 20 seconds. It doesnot have any redirect urls or anythings its a plain url. Why is it taking exactly 2 minutes for the connection to timeout?

NSURLRequest setTimeoutInterval does not work as expected

I have kept NSURLRequest timeout interval 30sec. And I have also configured the auto retry 3 times for request. So if any problem comes in request then total time should be 120 seconds (i.e. 2 mins).
But When i have kept Debug point on my server and if i request to server then my time out period is getting 3 minutes.
Can I configure this timeout??? Or it should work??
Is this default timeout interval Once request is made to Server??
Please note that 30 seconds times 3 is 90 seconds, or one and a half minutes, not 2 minutes.
As for the timeout problem, try to init your NSURLRequest with initWithURL:cachePolicy:timeoutInterval:. Make sure to check the status of your NSURLConnection delegate methods, especially in connection:didFailWithError:.
Also, maybe you should explain how you measure the time out period on the server.