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?
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 .
Cheers!
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).