Action when all HTTP Requests have been processed

I am running several HTTP requests, and they are using a batch interval of 40 every 2 seconds.

When ALL the HTTP requests have been processed, I want to do a MySQL Query.

To check for when the HTTP requests have completed, I tried an “If” with {{$node[“SplitInBatches”].context[“noItemsLeft”]}} but that didn’ work because I’m not actually using the Split In Batches node.

Then I tried an “IF” with {{$node[“HTTP Request”].context[“noItemsLeft”]}} but that didn’t work because noItemsLeft only works with Split In Batches.

I could add the Split in Batches node if that’s the easiest, but thought maybe there was a way to do it without adding another node, and simply using the HTTP Request batches ability.

Hi @mmac

Welcome to the community!

Could you share your workflow?
It seems something else is going wrong, as the HTTP node should simply finish after the batches and continue the workflow. I might be missing something.

1 Like

Here is the workflow. MySQL returns a number of items. Those are used with the Discord API in the HTTP Request node, 10 items per batch at 30 second intervals. After the HTTP request returns data, we update MySQL.

IF all items are processed from the HTTP Request and MySQL1, I want MYSQL2 to run once, then MYSQL3 to run once.

I am currently using a “Wait” to force the MYSQL node to not run until an approximate time later, hopefully by that time all the HTTP Request and MySQL1 have completed.

But as the number of items we process changes, that “Wait” time will need to be changed. So I am looking for a way to only move to run MySQL2 and MYSQL3 when all of the previous nodes have completed all the batches.

In other words, I need an “If” for “if all items from HTTP Request” are completed, but you can’t do IF {{$node[“HTTP Request”].context[“noItemsLeft”]}} on the HTTP Request’s built-in split in batches.

Every node will run for all items before going to the next node. So this wait shouldn’t be needed.
have you noticed strange behaviour without the wait?

1 Like

Ah ok. This one runs pretty quick so I wasn’t seeing that it was waiting to finish a node before it moved to the next one. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.