I have a scenario where the initial request will send a url path and the subsequent request should make use of that path as the url to be hit using get request from service. (This part is done)
Now the actual issue starts , the problem here is that the 2nd request will not give the output directly rather it will send the status as QUEUE until the response is fully processed. All I have to do is to wait/hit the url again until QUEUE state is changed to OK state (Actual response comes here).
Code for 2nd request :
getOriginalData(url:any){
const proxyRequest=this._getRequest(url)
return proxyRequest
.expand(response => {
if (response.uuid==null) {
this._getRequest(url);
} else {
Rx.Observable.empty();
}
return Observable.of(response);
});
private _getRequest(url:any){
return this._http.get(url)
}
I have been following this implementation to achieve my goal : Angular - Correctly using RXJS expand operator to make recursive http calls .
Using this implementation results in
ERROR RangeError: Maximum call stack size exceeded
But for some reason , it is not working as expected. How can I make a recursive call in a standard way such that it doesn't flood the network.