Scenario: It is required to make an API call every 3 minutes to update the status of a specific service within the application.
Here is my existing code snippet:
interval(180000)
.subscribe(() => this.doRequest
.pipe(catchError(() => {
this.applicationFlag = false;
return EMPTY;
}))
.subscribe(result => this.applicationFlag = result));
I am currently facing an issue where the previous interval request is not completed, but the next interval request is triggered.
Is there a way to set a flag to wait for the previous request to be completed before executing the next interval request?