fix(fields): await running queries during trigger (#8391)

# Which Problems Are Solved

During triggering of the fields table WriteTooOld errors can occure when
using cockroachdb.

# How the Problems Are Solved

The statements exclusively lock the projection before they start to
insert data by using `FOR UPDATE`.
This commit is contained in:
Silvan
2024-08-06 13:27:28 +02:00
committed by GitHub
parent 0f6003f9a1
commit 646ffe7a26

View File

@@ -113,6 +113,8 @@ func (h *FieldHandler) processEvents(ctx context.Context, config *triggerConfig)
} }
}() }()
// always await currently running transactions
config.awaitRunning = true
currentState, err := h.currentState(ctx, tx, config) currentState, err := h.currentState(ctx, tx, config)
if err != nil { if err != nil {
if errors.Is(err, errJustUpdated) { if errors.Is(err, errJustUpdated) {