Skip to content

Commit 481f256

Browse files
committed
idempotency reset scope for backend-triggered tasks
1 parent 25e4248 commit 481f256

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/idempotency.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,18 +428,22 @@ export const parentTask = task({
428428
});
429429
```
430430

431-
When resetting from outside a task (e.g., from your backend code), you must provide the `parentRunId`:
431+
When resetting from outside a task, you must provide the `parentRunId` if the key was created within a task context:
432432

433433
```ts
434434
import { idempotencyKeys } from "@trigger.dev/sdk";
435435

436-
// From your backend code - you need to know the parent run ID
436+
// If the key was created within a task, you need the parent run ID
437437
await idempotencyKeys.reset("my-task", "my-key", {
438438
scope: "run",
439439
parentRunId: "run_abc123"
440440
});
441441
```
442442

443+
<Note>
444+
If you triggered the task from backend code, all scopes behave as global (see [Triggering from backend code](#triggering-from-backend-code)). Use `scope: "global"` when resetting.
445+
</Note>
446+
443447
### Resetting attempt-scoped keys
444448

445449
Keys created with `"attempt"` scope include both the parent run ID and attempt number. When resetting from outside a task, you must provide both:

0 commit comments

Comments
 (0)