Stopping long running executions in bulk and automate it!

When your workflows reach a certain level of complexity, you may run into cases where there’s the rare one or two executions which never seem to stop running. Common sense says to stop these manually to preserve resources but stopping executions one by one via the UI may be impractical given enough of them.

Thankfully, there is a away to script this by using the n8n editor APIs.

In the following, I use the n8n editor APIs to (1) fetch the latest executions across all workflows and (2) stop those which are still running after an hour since starting. Adding a scheduled trigger means it’s something I can set-and-forget and keeps my n8n instance happy!

Bonus Tip: Set Max Number of Running Executions for a Workflow

Using the same N8N editor APIs, try this when you need to cap the maximum number of executions for a workflow. Great if you need to throttle concurrently executions to protect the stability of your instance.