Multiple webook calls overlaping

Hi there,

I created a flow starting with a webhook. The webhook receives information and changes data in a Google Sheet; this triggers calculations in the Google Sheet in order to send back the results once it’s calculated, at the end of the n8n workflow.
The problem is that the Google Sheet calculation takes some time to compute. Therefore when I am sending multiple calls to the webhook, the Google Sheet doesn’t have time to compute before sending the results.

Is it possible to wait for the n8n flow to be finished until processing the next webhook call ?
(I tried with a Split in batch but it’s not working as each webhook call is only one request, it’s therefore not possible to parse it)

Regards

Hey @mumudu22!

You can use the Function node to add a wait time. You might find this helpful :point_down:

Maybe best to have one workflow which simply writes the data directly somewhere like a Sheet or DB. And then have another workflow that runs as cron all few minutes and then processes all of that data at once.

Thanks for the answer Harshil but it’s not gonna work.
As the wait node is the same for every call, if I get 4 calls at the same time they will all wait 5 secs (for example) and trigger alltogether. This will lead to the same issue.

I would like to be able to store them in a bucket and trigger them one by one for example.

Btw. if you fear that multiple of that cron workflows could run at the same time. You can use the following workflow to check first if it is running already and only delay the next run until the existing execution finished:

2 Likes

Ok will try that :slight_smile:

Thanks both of you

Jan,

I tried implementing it on my n8n cloud instance.
I then changed the “url”: “http://localhost:5678/rest/executions-current” to my url : “https://[hidden].app.n8n.cloud/rest/executions-current” but the flow is not valid (see below).

The answer from the http node doesn’t have the same info than with the local url - it’s a list of text. How is it possible to get the right info?

info with local url :

info with the n8n cloud url :

There is no need to change the URL. The URL works fine as it is. In this case is localhost:5678 correct as n8n connects to itself.

Oh ok thanks a lot !
Works like a charm :wink:

Great to hear! Have fun!

It doesn’t work in my case. Workflow execution is so fast that all instances see multiple executions in progress. My goal was to run the first iteration and ignore the following ones. But with this system, all iterations are ignored. It would be so much easier to prevent parallel execution at n8n level.

1 Like

Hey @Denis_VICTORIA

Unfortunately this feature is not yet available with n8n, but you can use Redis for this.

There is a similar situation mentioned in another post: Deny simultaneously workflow execution / Don't execute if workflow is running - #8 by krynble

If you have access to a Redis you can follow the mentioned procedure.

Let me know if this works.

I added redis to my docker compose. It seems to work well as a workaround but this feature seems to be mandatory for real life cases (barcode scan for me).

Thank you for your help @krynble

1 Like

How can this be modified to detect if a specific workflow is running or not?

You can change the first line in the Function-Node. Replace $workflow.id.toString() with the workflow you want to check for like for example '123'. Make sure that it is a string and not a number.

So for example:

const executions = items[0].json.data.filter(execution => execution.workflowId.toString() === '123');
1 Like

Initially it was giving an error, “Authorization is required!”

I registered the credential on the http node as instructed

here the node was always returning as false, I changed “value1”: "= false {{$ json [" isActive \ “]}}”

to “value1”: "{{$ json [" isActive \ "] }} ", It worked

thank you so much

@jan looks like your solution workflow is gone. Would you be so kind to repost it or put it somewhere public, like github?

Cheers

@mattesilver it looks like it is still there, You may need to do a ctrl / cmd + F5 in your browser to see it.

Works now.
Cheers

@jan ,
Just had a chance to run it on a server. The n8n instance is configured with basic auth but looks like the API requires n8n-auth cookie. is there a way around?

Cheers