record_task_run_event(event: ReceivedEvent, depth: int = 0) -> None
Record a single task run event in the database.Delegates to record_bulk_task_run_events, which already retries once on
IntegrityError to recover from TOCTOU races against concurrent recorders.
Any IntegrityError that survives the retry is treated as an unrecoverable
duplicate and the event is discarded.
Record multiple task run events in the database, taking advantage of bulk inserts.Retries once on IntegrityError to handle TOCTOU races between concurrent
recorder instances: when two batches reference the same task_run.id with
different natural keys, one batch’s existence-check SELECT may run before
the other batch’s INSERT commits. The retry re-runs the SELECT in a fresh
session so the conflict target is chosen against the now-visible row.