anvilistas / anvil-labs

MIT License
9 stars 3 forks source link

Avoid Transaction Conflicts #35

Open meatballs opened 2 years ago

meatballs commented 2 years ago

The historic module gets a sequence number and writes that to the events table in a transaction.

In similar circumstances, I've seen high loads cause (probably spurious) transaction conflict errors.

I don't want to reduce the transaction strictness. Instead, I suggest..

The event writing uses a similar process to projections where only a single projector can exist at a given time.

A batch of Events would be written to a pending table as a list in a simple object column.

A writer process starts, checks for any already running and then handles batches of pending event writes.

(this starts to sound a lot like a block chain...)