Increase timeout of http call


When I do a small chain of rest calls to create something on a remote server, it works fine with 3 iterations. But when I do a bigger load I get timeouts, can I increase this somehow? I suspect that the remote server is getting busy and gets slower…

error: { [Error: ETIMEDOUT] code: 'ETIMEDOUT', connect: null },

When I do the same code with 3 apps: no problem

The REST call looks like this to create the app on the remote server:

function copyApp (guid, name) {
	console.log('Copy template: '+guid+' to new app: '+name);
	check(guid, String);
	check(name, String);

	return new Promise(function(resolve, reject){ 'post', 'http://''/'+config.virtualProxy+'/qrs/app/'+guid+'/copy?name='+name+'&xrfkey='+config.xrfkey, 
			headers: {
				'hdr-usr' : config.headerValue,
				'X-Qlik-xrfkey': config.xrfkey
		}, function( error, response ) {
			if ( error ) {
				console.error('error app copy',  error );
				throw new Meteor.Error('error app copy', error)
			} else if (response){
				// console.log('Copy app:  HTTP request gave response', );
				console.log('Copy app:  the generated guid: ',;				
				resolve(; //return app Guid

Thank you

Take a look at the timeout option in the Meteor HTTP API docs.

The weird thing here is that if you don’t specify the timeout option then there is no timeout. Perhaps it’s timing out on the other end?

Thanks! That was the case. So the situation now is that I thought I could return a promise object in my method which apparently does not work out of the box. So waiting for an answer in my other question for that.

Second, they told me always to use bluebird and not native promises. That bluebird has a map function with which you can throttle

with bluebird[1,2,3,4,5], function(id) {
    return DoSomethingAsyncLikeCopyApp(id);
}, { concurrency: 1 })
.then(function() {