TIL

A retry needs an idempotency boundary

Check which side effects can happen twice before adding automatic retries.

Before retrying a task, list its side effects. A repeated read and a repeated payment have different consequences.

Give the operation a stable identifier. Check whether it has already completed before applying the side effect again. Keep that check and the write in the same transaction when the database supports it.