Stop executions for running too long

I have a few workflows which run normally - start and finish. Rarely they run for an extraordinary amount of time. I would love to stop a workflow if it runs more than a few minutes but the built in feature in n8n seems to not be working as intended. Keep in mind that the workflow in question should fully be able to be completed in <30 seconds.

Maybe someone has a solution for the problem I’m facing? Maybe I could make a schedule trigger workflow that just checks all the running workflows and if they have instances of 10+ minutes I can stop them automatically?

Thanks in advance

john7

Information on your n8n setup

  • n8n version: latest one
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): self-hosted
  • Operating system: MacOS

If the process status is ‘running’ theres no API to cancel that.
For others statutes like ‘waiting’ etc… yes.
A workaround yea, move i a subworkflow , maybe use a Data Table to get Execution Id , and use running / stopped to further take actions.
But i repeat, if the procces status is ‘running’ for the workflow, only the UI button can stop/cancel or shut down n8n…
Maybe someone knows more :thinking:.
Cheers!

Can’t I somehow GET all execution info with a HTTP node and just DELETE it via another HTTP node?

Yes, you can get execution id even with expressions inside any node you like.
Or use the n8n API to GET them.
BUT ATTENTION: IF THE STATUS OF A WORKFLOW EXECUTION IS ‘running’ ONLY THE BUTTON IN UI CAN STOP(or a workaound that require to change logic of your workflow).

Ah, that’s unfortunate. I should make this a feature request then :grinning_face_with_smiling_eyes:

Is there like any setting that just sets max amount of time for the entire n8n instance? Like somewhere in like a settings file or something.

EXECUTIONS_TIMEOUT=3600(seconds)
In your .env file or docker yml .
This will stop i think all executions .

Not necessary to stop n8n itself lol.

I didn’t checked yet, but yea, why not.

2 Likes

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