Skip to content

Commit c54de7e

Browse files
committed
cleanup all the quotes
1 parent 6c73be8 commit c54de7e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/idempotency.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ The `scope` option determines how your idempotency key is processed. When you pr
133133
| `"attempt"` | `key + parentRunId + attemptNumber` | Key is combined with the parent run ID and attempt number | Allow child tasks to re-run on each retry of the parent |
134134
| `"global"` | `key` | Key is used as-is, no context added | Ensure a task only runs once ever, regardless of parent |
135135

136-
### `"run"` scope (default)
136+
### `run` scope (default)
137137

138-
The `"run"` scope makes the idempotency key unique to the current parent task run. This is the default behavior for both raw strings and `idempotencyKeys.create()`.
138+
The `run` scope makes the idempotency key unique to the current parent task run. This is the default behavior for both raw strings and `idempotencyKeys.create()`.
139139

140140
```ts
141141
import { idempotencyKeys, task } from "@trigger.dev/sdk";
@@ -159,11 +159,11 @@ export const processOrder = task({
159159
});
160160
```
161161

162-
With `"run"` scope, if you trigger `processOrder` twice with different run IDs, both will send emails because the idempotency keys are different (they include different parent run IDs).
162+
With `run` scope, if you trigger `processOrder` twice with different run IDs, both will send emails because the idempotency keys are different (they include different parent run IDs).
163163

164-
### `"attempt"` scope
164+
### `attempt` scope
165165

166-
The `"attempt"` scope makes the idempotency key unique to each attempt of the parent task. Use this when you want child tasks to re-execute on each retry.
166+
The `attempt` scope makes the idempotency key unique to each attempt of the parent task. Use this when you want child tasks to re-execute on each retry.
167167

168168
```ts
169169
import { idempotencyKeys, task } from "@trigger.dev/sdk";
@@ -188,9 +188,9 @@ export const syncData = task({
188188
});
189189
```
190190

191-
### `"global"` scope
191+
### `global` scope
192192

193-
The `"global"` scope makes the idempotency key truly global across all runs. Use this when you want to ensure a task only runs once ever (until the TTL expires), regardless of which parent task triggered it.
193+
The `global` scope makes the idempotency key truly global across all runs. Use this when you want to ensure a task only runs once ever (until the TTL expires), regardless of which parent task triggered it.
194194

195195
```ts
196196
import { idempotencyKeys, task } from "@trigger.dev/sdk";
@@ -213,7 +213,7 @@ export const onboardUser = task({
213213
```
214214

215215
<Note>
216-
Even with `"global"` scope, idempotency keys are still isolated to the specific task and environment. Using the same key to trigger *different* tasks will not deduplicate - both tasks will run. See [Environment and task scoping](#environment-and-task-scoping) for more details.
216+
Even with `global` scope, idempotency keys are still isolated to the specific task and environment. Using the same key to trigger *different* tasks will not deduplicate - both tasks will run. See [Environment and task scoping](#environment-and-task-scoping) for more details.
217217
</Note>
218218

219219
## Default behavior
@@ -222,7 +222,7 @@ Understanding the default behavior is important to avoid unexpected results:
222222

223223
### Passing a raw string
224224

225-
When you pass a raw string directly to the `idempotencyKey` option, it is automatically processed with `"run"` scope:
225+
When you pass a raw string directly to the `idempotencyKey` option, it is automatically processed with `run` scope:
226226

227227
```ts
228228
// These two are equivalent when called inside a task:
@@ -231,7 +231,7 @@ await childTask.trigger(payload, { idempotencyKey: await idempotencyKeys.create(
231231
```
232232

233233
<Warning>
234-
**Breaking change in v4.3.1:** In v4.3.0 and earlier, raw strings defaulted to `"global"` scope. Starting in v4.3.1, raw strings now default to `"run"` scope. If you're upgrading and relied on the previous global behavior, you must now explicitly use `idempotencyKeys.create("key", { scope: "global" })`.
234+
**Breaking change in v4.3.1:** In v4.3.0 and earlier, raw strings defaulted to `global` scope. Starting in v4.3.1, raw strings now default to `run` scope. If you're upgrading and relied on the previous global behavior, you must now explicitly use `idempotencyKeys.create("key", { scope: "global" })`.
235235
</Warning>
236236

237237
This means raw strings are scoped to the parent run by default. If you want global behavior, you must explicitly create the key with `scope: "global"`:
@@ -244,7 +244,7 @@ await childTask.trigger(payload, { idempotencyKey });
244244

245245
### Triggering from backend code
246246

247-
When triggering tasks from your backend code (outside of a task), there is no parent run context. In this case, `"run"` and `"attempt"` scopes behave the same as `"global"` since there's no run ID or attempt number to inject:
247+
When triggering tasks from your backend code (outside of a task), there is no parent run context. In this case, `run` and `attempt` scopes behave the same as `global` since there's no run ID or attempt number to inject:
248248

249249
```ts
250250
// In your backend code (e.g., an API route)

0 commit comments

Comments
 (0)