HaveAGitGat / Tdarr

Tdarr - Distributed transcode automation using FFmpeg/HandBrake + Audio/Video library analytics + video health checking (Windows, macOS, Linux & Docker)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need infinite loop protection for Flows

rgreen83 opened this issue · comments

Describe the bug

It is possible to create an infinite loop with flows that are difficult to detect for the user because it just looks like a long running job on the surface.

To Reproduce

I have a primary flow which has the onFlowError step which leads to goToFlow step which leads to a separate flow meant to perform some work on the file to correct whatever caused it to fail the original flow. That repair flow then calls resetFlowError and goToFlow back to the original flow. Generally this has worked fine but I just caught a job that had been in a loop for days with a 36MB log file that couldn't be loaded in browser before I figured it out and kill the job.

Flow1>onFlowError>goToFlow2>resetFlowError>goToFlow1

Expected behavior

I am not a programmer so I don't know exactly the best way to handle this for Tdarr but I have some scripting experience and have resolved loops with counters and flag checks. I haven't seen any evidence of counters in Tdarr logs so that may not be an option but maybe a flag that would allow reset flow error only once per job? Time based termination is probably not an option due to some users may have extremely long jobs intentionally. Another option might just be exposing more info to the user on the job status that could help with realizing there is a loop like showing a counter for errors or resets?

You can use the Set Flow Variable and Check Flow Variable for this. After your second flow has been attempted can set e.g. flow2Done to true. Can then check this in flow 1 and if already done then fail the flow.