Issue with Retool sending API requests too quickly

I wrote an automation that will use results from a SQL query to update inventory counts in Shopify using their APIs. Roughly 600 items are updated, so around 600 API POSTs are sent.

I have tried putting sleeps (I wrote a small sleep function to make the code wait a few seconds between queries). Problem is Retool seems to ignore this and batch all the API POST calls to be sent at the end.

Shopify's API then promptly freaks out because their 4 requests per second limit gets surpassed. Is there some way to slow down the requests or prevent Retool from batching these requests?

In the code below I tried splitting the large array of items into smaller item arrays hoping it would slow down and process each chunk in real-time, but it still displays the same behavior of batching the requests at the end.

`while (oracArray.length > 0) {
var smallArray = oracArray.splice(0,20) 
smallArray.forEach((row) => fetchInvId.trigger({
    additionalScope: {
        passSKU: row.ITEM_NUM
    onSuccess: function(data) {
      	startingNum = startingNum + 1
        progressText.setValue("Rows processed: " + startingNum)
        //If statement checking if the inventory item is present within the response JSON
        if (Object.values(data)[0].productVariants.edges.length == 0) {
            errors += "Item " + row.ITEM_NUM + " does not exist in Shopify \n\n"
        } else {
            var shopifyInvId = Object.values(data)[0].productVariants.edges[0]
            shopifyInvId = /[^/]*$/.exec(shopifyInvId)[0]
                additionalScope: {
                    passLoc: locationId,
                    passInvId: shopifyInvId,
                    passQuantity: row.ONHAND_QTY
              onSuccess: function(data) {
              onFailure: function(data) {
                errors += 'Unable to update inventory SKU: '+ row.ITEM_NUM + ' ItemDescription: '+ row.DESCRIPTION +'\n\n';

Check out this post


Hi Team,

I have a similar task as JayC mentioned. I want to sync my user details from Shopify API. Since, Shopify API takes 2 seconds to create a user detail. I want to know if it is possible to do 1000 requests or 1000 loops and it needs to await a response before triggering second response.

Kindly let me know your thoughts.

Aditya Saligram Singh