Synchronization Points

Synchronization Points

Managing state conflicts.

Synchronization Points

When 3 nodes run in parallel, they race to update the state.

The Race Condition

  • Node A: state["count"] = 1
  • Node B: state["count"] = 2

Who wins? The last one to finish. This is bad.

The Solution: Reducers

Instead of replacing values, reduce them.

  • Node A: return {"counts": [1]}
  • Node B: return {"counts": [2]}

The Reducer function (e.g., operator.add) merges them: state["counts"] == [1, 2]. Thinking in parallel requires you to design your State Schema to support concurrent partial updates.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn