Any way to semaphore a workflow?

I have a recursive backend workflow that does the job, but I am worried that a user might start another before the first is done which would result in an indeterminate result that was definitely wrong.

Is there a way to know when a recursive workflow has completed?

Can you set a database field when they start the API workflow, then change the database field at the last run of the workflow? That way, you can have a condition to not allow the user to start another until the job is complete.


I could, if I knew what the last recursion was. But as near as I can see bubble offers me no way to determine that. I just recurs until it bottoms out.

Any kind of branching would make this a whole lot simpler. Looping would be even better…

So… I followed up on “conditional” and found I could stop a workflow from running on a condition, which would at least prevent me from bottoming out. But how can I check a field that holds a “thing”'s primary key to see if its empty (its the parent field, which is empty at the tree root.)

I could btw create a semaphore field to check before I start the recursion but (a) i have no idea how to clear it at the end (b) this whole thing makes me VERY nervous of race conditions… is a workflow condition check guaranteed to be atomic with the workflow itself?

1 Like