Skip to content

Commit 17de59a

Browse files
isshaddadTrigger.dev RepoOps
authored andcommitted
docs: explain the crash window when recording side effects locally
Mono-RevId: 1ce82166d5fbdfcfb647c709dd111bd02ba02dd4
1 parent 10678e5 commit 17de59a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎docs/idempotency.mdx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ The run ID protects against retries of one run. If the same task can be triggere
7474

7575
Use a Trigger.dev idempotency key to stop a retry triggering a task twice, and the provider's idempotency key to stop a retry calling the provider twice. For a side effect with no idempotency support, record that you performed it in your own database and check that record before performing it again.
7676

77+
That record narrows the gap but can't close it, because the record and the provider call can't be written together. If the worker stops between them:
78+
79+
- Recording before the call can lose the effect: the retry sees the record and skips it.
80+
- Recording after the call can repeat the effect: the retry finds no record and calls the provider again.
81+
82+
Marking the operation as in progress before the call and as done after it stops a retry from guessing, but it doesn't finish the work. If a retry finds the operation still in progress, the effect may or may not have happened. Check with the provider or flag the run for review. Only send the request again once you've confirmed the first attempt had no effect and can't take effect later.
83+
7784
## `idempotencyKey` option
7885

7986
You can provide an `idempotencyKey` when triggering a task:

0 commit comments

Comments
 (0)