How can I increase the timeout value of a Worklight adapter procedure? My app crashes and I see the following in the exception details:
"response [/apps/services/api/index/common/query] success: /-secure-
{"responseID":"24","errors":["Invocation of procedure 'getFTTitle' has
timed out after 30
sec."],"isSuccessful":false,"warnings":[],"info":[]}/ "
There are several places in Worklight where a timeout value can be specified:
CLIENT ----> WORKLIGHT SERVER -- (adapter) --> BACKEND
You can increase the adapter procedure timeout (Worklight Server --> Backend) as follows:
<procedure name="nameHere" requestTimeoutInSeconds="valueHere"/>
I don't know what is your specific use case, so be sure to also increase the client-side timeout. Have them match each other.
WL.Client.invokeProcedure(invocationData,{
onSuccess : getDataSuccess,
onFailure : getDataFailure,
timeout : valueHere
});
Also note that if you need to increase your timeout to a whole minute, consider that something may not be right here...
var wlInitOptions =
{
// # Worklight server connection timeout
timeout: 60000,
...
}
Related
My Rails Application Uses AWS SDK v3 to invoke lambda functions as follows
lambda_client = Aws::Lambda::Client.new(client_config)
lambda_return_value = lambda_client.invoke(
{
function_name: function_name,
invocation_type: 'RequestResponse',
log_type: 'None',
payload: generated_payload,
}
Most of my lambda functions execute successfully, but the ones that take longer than ~60sec result in the following exception on the ruby side even though the lambda executes completely
A Seahorse::Client::NetworkingError occurred in background at 2019-07-11 00:47:18 -0500 :
Net::ReadTimeout
I have gone through the documentation and cannot find a way to set a longer timeout for my lambda invocation. Any ideas how to get ruby to wait for the invocation and not timeout?
Hi Aws::Lambda::Client default timeout is 60 but you can change this while creating new client. Set :http_read_timeout in your client_config
client_config = {
....
http_read_timeout: 100
}
then create new client
lambda_client = Aws::Lambda::Client.new(client_config)
For more reference: https://docs.aws.amazon.com/sdkforruby/api/Aws/Lambda/Client.html
I hope that helpful
I created a test where I setup a route, try to visit a page which makes an API request to the route and then wait for the route response:
cy
.server()
.route('GET', '/api/testing')
.as('testing');
cy.visit('/index.html', { timeout: 60000 });
cy.wait('#testing', { timeout: 60000 });
This only waits for the Cypress global default responseTimeout of 30 seconds and then fails the API request.
Here's the error message logged by Cypress in the console:
Cypress errored attempting to make an http request to this url:
https://localhost:4200/api/testing
The error was:
ESOCKETTIMEDOUT
The stack trace was:
Error: ESOCKETTIMEDOUT
at ClientRequest. (…\node_modules\cypress\dist\Cypress\resources\app\packages\server\node_modules\request\request.js:778:19)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:105:13)
at ClientRequest.emit (events.js:207:7)
at TLSSocket.emitTimeout (_http_client.js:722:34)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:105:13)
at TLSSocket.emit (events.js:207:7)
at TLSSocket.Socket._onTimeout (net.js:402:8)
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
at Timer.listOnTimeout (timers.js:264:5)
Adding a responseTimeout to the global config of Cypress will increase the timeout, but why isn't the timeout for either the visit or the wait occurring?
See the code example on this page commands - wait - Alias
// Wait for the route aliased as 'getAccount' to respond
// without changing or stubbing its response
cy.server()
cy.route('/accounts/*').as('getAccount')
cy.visit('/accounts/123')
cy.wait('#getAccount').then((xhr) => {
// we can now access the low level xhr
// that contains the request body,
// response body, status, etc
})
I would add the then((xhr) => to your code and see what response is coming through.
Logic says that if a bogus route waits the full timeout, but a 'failed legitimate route' does not, then a response with failure code is being sent back from the server within the timeout period.
The block of code in request.js where the error comes from has an interesting comment.
self.req.on('socket', function(socket) {
var setReqTimeout = function() {
// This timeout sets the amount of time to wait *between* bytes sent
// from the server once connected.
//
// In particular, it's useful for erroring if the server fails to send
// data halfway through streaming a response.
self.req.setTimeout(timeout, function () {
if (self.req) {
self.abort()
var e = new Error('ESOCKETTIMEDOUT') <-- LINE 778 REFERENCED IN MESSAGE
e.code = 'ESOCKETTIMEDOUT'
e.connect = false
self.emit('error', e)
}
})
}
This may be a condition you want to test for (i.e connection broken mid-response).
Unfortunately, there seems to be no syntax cy.wait().catch(), see Commands-Are-Not-Promises
You cannot add a .catch error handler to a failed command.
You may want to try stubbing the route instead of setting the breakpoint on the server, but I'm not sure what form the fake response should take. (Ref route with stubbing)
.vist() and .wait() didn't work for me, error logs on cypress suggested using .request() instead which works fine.
cy.server();
cy.request('/api/path').then((xhr) => {
console.log(xhr.body)
})
I am using nusoap in my PHP application when calling a .net webservice.
The issue is, in some cases .net web service is taking more than actual time for some request, so I want to increase the time my SOAP call waits for the response.
Is there any function or any way that I can keep nusoap call waiting until I get a response from the webservice.
Thanks,
Rama
Nusoap default timeout is 30 secs.
Increase Response timeout to solve this problem.
// creates an instance of the SOAP client object
$client = new nusoap_client($create_url, true);
// creates a proxy so that WSDL methods can be accessed directly
$proxy = $client -> getProxy();
// Set timeouts, nusoap default is 30
$client->timeout = 0;
$client->response_timeout = 100;
Note : This settings also didn't work for some time. So i directly went to nusoap.php file and changed $response_timeout = 120. By default this value set to 30 secs.
It is solved now :)
References : Time out settings - Second reference
When you create the istance of the nusoap_client try
$client = new nusoap_client($$creat_url, true,false,false,false,false,0,300);
where all the false parameters default to false,
0 is the timeout and 300 is the response_timeout
Thanks
I am trying to connect many socket.io clients for different URLs in Node.js like so :
app.get('/:id',function(req,res){
io.of('/'+id).on('connection',function(socket){
socket.emit('hello');
})
});
This works however there is a problem :
When a browser refreshs the page http://localhost:3000/xyz for example, the event socket.emit gets fired two times.
If someone accesses the page http://localhost:3000/xyz 10 times, then the event fires 10 times.
This is not good because everytime the user visits that page, the socket events will be fired n+1 times.
What should be done so that I can register sockets to different URLs and at the same time not have this anomaly .
Another thing :
If I do this :
var sock;
io.of('/'+xyz).on('connection',function(socket){
sock=socket;
})
app.get('/:id',function(req,res){
sock.emit('hello');
})
If I use the above code then the socket doesn't get saved succesfully to the sock variable in time. What that means is , I have to do a setInterval of about 1000 .. so that the
sock=socket
line gets fired.
Please help me.
Because with this, in each request to http://localhost:3000/id, you register a new handler, you should be doing that once, not at every request.
app.get('/:id',function(req,res){
io.of('/'+id).on('connection',function(socket){
socket.emit('hello');
})
});
I use below approach to achieve this goal:
client side:
var socket = io.connect('http://localhost:8183/?clientId='+clientId,{"force new connection":true});
server side:
var io = require('socket.io').listen(server);
io.sockets.on('connection', function(socket) {
console.log("url"+socket.handshake.url);
clientId=socket.handshake.query.clientId;
console.log("connected clientId:"+clientId);
});
reference:https://github.com/LearnBoost/socket.io/wiki/Authorizing#global-authorization
How can i create/convert this script into model in Backbone that can use SignaR Hubs? For example:
<script type="text/javascript">
$(function () {
// Proxy created on the fly
var chat = $.connection.chat;
// Declare a function on the chat hub so the server can invoke it
chat.addMessage = function (message) {
alert("message");
};
// Start the connection
$.connection.hub.start();
});
</script>
EDIT
I did come up with this:
window.Message = Backbone.Model.extend({
hub: undefined,
initialize: function () {
this.hub = $.connection.message;
},
addMessage: function (message) {
alert(message);
},
connect: function () {
$.connection.hub.start();
var messages = this.hub.getAll();//get messages
}
});
but this is not working due to the following error:
this error: :55885 Unexpected response code: 200
If you use default settings SignalR will first try to send a websockets poll to the server. The :55885 is simply the port number of your server. Websockets protocol expects a response status code of 101 (see http://dev.w3.org/html5/websockets/).
If running IIS, unless you run Windows 8 with ASP.NET 4.5 your webserver, it will not recognize a web sockets request and (begin speculation) treat it as a normal get request and return status code 200 (OK) (end speculation) which is an unexpected response in the eyes of the websockets initiator. When this happens SignalR falls back to longpolling instead.
This might not answer your question but it will help you understand the error you get (which is likely not the reason why your code doesn't work)
Also, check out http://srtsolutions.github.com/backbone.signalr/ which is a Backbone.js/SignalR integration Nuget package.