Best way to run every second?

Hello, I would like to run this scenario:

I want to create a bidding system for my app. I need to place bidding orders (fishing industry) for one of our suppliers.

I want, for example, to run a scenario five times/second for like 10-15 seconds. I have thought of using cron to complete this task using custom selection.

So my question is: It’s possible to configure a scenario that will run automatically at x day at 22:00 for 10 seconds and run 5-6 post calls/second?

Thanks.

As you mentioned, you can use the cron node to run the workflow at a specific time.

Why does the workflow need to last precisely 10 seconds?

Because the requests open at 22:00:00 and need to make sure my bidding will pass, and they usually close in 3-4-5 seconds. So need to make sure my requests will pass for at least 5-10 seconds which generally is the time before it closes.

You could try something like this:

I tested the logic with:

Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "URL",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        820,
        300
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        820,
        480
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "n",
              "value": 50
            }
          ]
        },
        "options": {}
      },
      "name": "Set n = 0",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        440,
        300
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "n",
              "value": "={{$node[\"IF n > 0\"].json[\"n\"] - 1 }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set n - 1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        990,
        130
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.n }}",
              "operation": "larger"
            }
          ]
        }
      },
      "name": "IF n > 0",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        620,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set n = 0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Set n - 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set n = 0": {
      "main": [
        [
          {
            "node": "IF n > 0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set n - 1": {
      "main": [
        [
          {
            "node": "IF n > 0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF n > 0": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

With this i was able to achieve around 23 POST requests/second.

2 Likes