I'm using Angular 9. I invoke an HTTP endpoint a number of times, using the loop below ...
getImage(id) {
let api = `${this.endpoint}/my-image?id=${id}`;
return this.http
.get(api, {headers: this.headersMultiPartForm, responseType: "blob"})
.pipe(retry(this.retry), catchError(this.handleError));
}
...
results.forEach(( componentarray, key ) => {
const idx = key + startingIndex;
if (!this.data[idx].url) {
...
this.myService.getImage(imageId).subscribe(data => {
this.createImageFromBlob(data, index);
}, () => {
this.isImageLoadingArr[index] = false;
});
}
});
This spawns a number of OPTIONS and GET requests. I would expect the requests to be launched (basically) at the same time, even though the server may take varying lengths to respond to each. However, in my network settings, I'm not finding this. It seems some requests are blocked and waiting for others. Notice these consecutive requests
There is a 1.5 - 2 second delay between some consecutive requests. This seems to happen across different browsers. Is there a concurrency setting in Angular that I can adjust to prevent this blocking from occurring?