I concur with Bruce in that uncontrolled API execution can lead to exceeding burst rate limit... it actually doesn't take much, especially if the number of users and when the user invokes the service(s) is unknown.
At a minimum I would use promises with a timer if not waiting for the prior service to complete. You will have a much more predictable user experience. Check out this simple example
codevar firstMethod = function() {
var promise = new Promise(function(resolve, reject){
setTimeout(function() {
console.log('first method completed');
resolve({data: '123'});
}, 2000);
});
return promise;
};
var secondMethod = function(someStuff) {
var promise = new Promise(function(resolve, reject){
setTimeout(function() {
console.log('second method completed');
resolve({newData: someStuff.data + ' some more data'});
}, 2000);
});
return promise;
};
var thirdMethod = function(someStuff) {
var promise = new Promise(function(resolve, reject){
setTimeout(function() {
console.log('third method completed');
resolve({result: someStuff.newData});
}, 3000);
});
return promise;
};
firstMethod()
.then(secondMethod)
.then(thirdMethod);
/code
I could be wrong though.