Add pause / wait on js query?

I am calling a rest api with a rate limit of 300 per minute, is their a simple way in retool to do that or do I need to rewrite my query? If so can somebody help me :slight_smile:

const arr = getean.data;
const eanValues = arr.map((item) => item.ean);

const promises = eanValues.map((ean) => {
  return eanloop.trigger({
    additionalScope: {
      ean: ean,
    },
  });
});

return Promise.all(promises);

I use this code to do a non-blocking wait:

await new Promise(resolve => setTimeout(resolve, 1000))

Hey @Sander!

There are some ideas about how to add a delay to a batched query in this thread - the delay function there uses the pattern @bradlymathews is referring to!