What happens when two workflows access the same Thing simultaneously?

Say you pass a thing to multiple workflows that make edits to it at the same time. Is it possible for two workflows to change 2 fields on the same thing at the same time?

Example:

Thing 1

  • Field A
  • Field B

Workflow Z edits Thing 1’s Field A ←→ Workflow X edits Thing 1’s Field B

Is this allowed? I don’t see any documentation about this.

1 Like

you might have a race condition problem, i suggest setting up custom workflows, and run them in chains.

1 Like

If it’s different fields there should not be any problems since it’s still PostgreSQL underneath it all.

The problems comes when 2 or more workflows try to edit the same field of a record at the same time since Bubble does not allow much concurrency control to builders.

But has anyone actually tried this? Do we know for a fact? It would be cool if @petter could gather the “final word” on this from the engineers.

I also would want to know what actually happens here. Does a change always get made, and it’s just the last workflow to edit the field?

What are you concerned about? Users or AI causing writes simultaneously?

1 Like

Using workflows as actions since Bubble has no parallelization for API calls.

I have. It’s a record that stores different global values for a tenant. Updates different field types at any one point of time. Never experienced any issues but that’s my anecdote.

Race conditions will break things. Last update wins. Scheduling can alleviate but there will always be edge cases. I tried to use scheduling delays in my booking system but it broke way to often during peaks.

1 Like

And this is multiple workflows doing this?

OK, thank you, good to know.

Would probably use durable object or something if I ever need to do this (as per a tip from someone on this forum :wink: ).

1 Like

Not a problem then. Different fields don’t interfere with each other.

Yeah. Different workflows for different components that update a tenant’s Global settings.

1 Like