Deny simultaneously workflow execution / Don't execute if workflow is running

Hey David.

Yes, using Redis is great. In order to guarantee atomicity it would be even better if we could use the INCR operation.

It is still not available on n8n but I just created a PR with this feature. Here: Adds increment operation to Redis by krynble · Pull Request #1745 · n8n-io/n8n · GitHub

The INCR operation increments a key by 1 unless another number is given. It also allows you to set an expiry timer.

If the key does not exist, it creates the key and assigns 1 to it. It also always returns the created key.

So you could use something like INCR semaphore and only proceed with the workflow execution if the result is 1.

Here is an example on Redis:

Screenshot from 2021-05-05 12-02-56

Should be released soon and can grant you the necessary atomicity of executions.

1 Like