I have a scenario where I need to call a service method(which will call HTTP post method) repetitively until I get the results and for that I am using interval.
In below code the getReportResultsList(id)method will be get called in the interval of 100 ms. The problem is, the server may take 300 ms time to process the first request and return the results. But at the same time 2 more requests are going to the server to get the results because of interval(100). So after getting the results from the first request i don't want to process the unexpected 2nd and 3rd requests response results. So I don't want to process the 2nd and 3rd responses. Can any one know how to to deal with these out of order responses? Thanks. let subscriber = Observable.interval(100).subscribe(() => { this.reportService.getReportResultList(id) .subscribe(result => { this.reportResults = result; if (this.reportResults) { this.prepareViewData(result); subscriber.unsubscribe(); } }); }); -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.