I'm facing an troublesome issue, because it does not occurs every time: I call webservices with angularJS (hosted in Django/Tastypie), with promises sothat WS2 (Web Service #2) is called only when WS1 has been successfully executed, etc.
The code looks like this:
myfunc = function() {
callPromiseWS1()
.then(function(data){
callPromiseWS2()
})
.then(function(data){
callPromiseWS3()
})
};
- WS2 is a POST request that writes stuff in Database.
- WS3 is a POST request which uses stuff created by WS2.
Sometimes (and not always), WS3 fails because the object that should have been already created by WS2 does NOT exist.
Of course, if I try to execute the WS3 request later manually, it works.
I have the feeling that WS2 and WS3 are executed in parallel, that's not what I expect.
Any idea? Thank you.