Issue with Batch Interval field in HTTP Call Node

Hello all,
I am making a http calls for multiple items from previous node. To avoid API rate limit error I am setting batch interval to 1.5s. In the screenshot there are 21 items in the previous node. So there should be 21 API calls with interval of 1.5s which leads to execution time of my workflow for alteast 31.5s (21*1.5). But the execution time for workflow is 6s which is much less than expected execution time. Due to this my flow is having API rate limit error for large number of items.
Can any help me with this.
Thanks,
Workflow:
Screenshot 2021-11-15 at 1.20.41 PM
Previous Node:
Screenshot 2021-11-15 at 1.20.09 PM
Http Node:
Screenshot 2021-11-15 at 1.20.27 PM
Execution Time:

Hey @Mustafa_Ali,

What I would do is send the HTTP request to a server or service you control like Pipedream and see how often the requests are being sent, I have done a quick test here using the worklfow below and it appears to be working as expected.

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://google.com",
        "responseFormat": "string",
        "options": {
          "batchInterval": "=2500",
          "batchSize": "=1"
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        620,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const newItems = [];\n\nfor (let i=0;i<21;i++) {\n  newItems.push({\n    json: {\n      id: i\n    }\n  });\n}\n\nreturn newItems;\n"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        430,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Any chance you could give it a run and see if that is working as expected for you as well? I have tested on version 144 and 149, Is that function node returning 21 results or do you have 21 resutls from somewhere else then a split in batches being used and that function just updates the one item for the batch?

1 Like

Hey @jon,
I tried your workflow. It is working as expected. I don’t know whats going wrong with my workflow. I am using the Batch Interval value as expression from previous set node. Is there any data type issue with batch interval values? Currently I am passing the value as integer should I change it to string?

My function node is returning 21 items to make 21 http calls. I am already using split into batches node at the parent level of my workflow. With 2 nested split into batches my workflow was not working properly previously so I used this approach.

Hey @jon ,
I got the issue with my workflow. It is with setting the batch interval value as expression. In your workflow I used the value of batch interval as expression from a set node, for that the delay was not working between the http calls.
Is there a way I can set different delays depending on the trigger.

Hey @Mustafa_Ali,

I don’t see why not, where are you setting the batch interval in the workflow? is it in the loop or outside of it?