How to use the current API to check if current workflow is running?

How do I check to see if the current workflow is running?

Please share your workflow

ERROR: The connection timed out, consider setting ‘Retry on Fail’ option in the node settings

connect ETIMEDOUT 20.79.198.7:5678

Information on your n8n setup

  • n8n version: 1
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
  • Operating system:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@n8ninja any thoughts?

There currently is not a way to see if a workflow is currently running unless it is in a waiting state using a wait node.

What would your usecase be? This workflow would likely only take a couple seconds to run.

You could store data at the start and end of each workflow run to see if one is running but that is likely more work than it is worth.

Hi,

We have a longer running workflow to sync contacts and appointments. It can take up to a minute or more, or in some rare cases several minutes to run.

The workflow cannot be allowed to run again at the same time or the data will be corrupted, trying to run on the same appointments at the same time.

This is a huge issue and has been requested in the forum several times… it has always worked.

How can I use a wait node instead?

You can’t wait and perform actions at the same time, so that won’t work for you. in this case

I made a workflow for you. All you need to do is substitute a unique ID and add your logic in the middle.
This saves a file on your system with the name of the ID then deletes the file when the workflow is done. The first step checks if the file already exists, which is the check if it is already running as it will not exist if it is not running.

I put some effort into explaining in the workflow as I have seen others request this as well, hopefully this is helpful to them as well.

Let me know if you have any questions

Edit: See the workflow here for self hosted and here for cloud.

1 Like

Thank you so much! I will give it a try.

I actually forgot you were on cloud so that won’t work for you. You can do the same thing with any spreadsheet or database service which i showed here using google sheets.

1 Like

Interesting approach, thank you @liam

Out of curiosity, I tried to build one solution using Google Sheets. I added a buffer approach, so the workflow can wait for the previous one to be executed.

A limitation of using the Google Sheets API for this is their quota per user limitation.

However, for an internal tool that is not triggered intensively, it should do the job.

Buffer is a nice addition, depends on use case if needed, but you would be right that you usually don’t want to just loose that data in most cases

I used sheets as a beginner example, should be easy to swap for a more robust DB for anyone that has any experience with that. Rate limits would be something to watch out for. @The_Leading_Practice if you use sheets or any other external storage through API then set the node settings to retry if failed after 5000 ms

Edit: I since updated the original post to add a timestamp for expiration and a buffer. can see it here @n8ninja