using the javascript SDK that aws provides.
I have a loop that get executed every 16 seconds, in this loop i get the state of each pipeline I have, which comes out to about 20 pipelines and 20 api calls.
My problem is that when this loop gets executed I sometimes end up with some throttling errors from AWS on some states i try to fetch.
I need to some how add like a 1 or 2 second delay before each call to getPipelineState so im not met with throttling errors
below is the code
this.interval = setInterval(async function () {
await Promise.all(pipelines.map(async pipeline => {
let params = {name: pipeline};
let data = await codepipeline.getPipelineState(params).promise();
// do stuff with response
//some sort of delay before the next pipelines state is fetched
}));
}, 16000);