You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/triggering.mdx
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -861,14 +861,37 @@ The `debounce` option accepts:
861
861
862
862
-`key` - A unique string to identify the debounce group (scoped to the task)
863
863
-`delay` - Duration string specifying how long to delay (e.g., "5s", "1m", "30s")
864
+
-`mode` - Optional. Controls which trigger's data is used: `"leading"` (default) or `"trailing"`
864
865
865
866
**How it works:**
866
867
867
868
1. First trigger with a debounce key creates a new delayed run
868
869
2. Subsequent triggers with the same key (while the run is still delayed) push the execution time further
869
-
3. Once no new triggers occur within the delay duration, the run executes with the **first** payload
870
+
3. Once no new triggers occur within the delay duration, the run executes
870
871
4. After the run starts executing, a new trigger with the same key will create a new run
871
872
873
+
**Leading vs Trailing mode:**
874
+
875
+
By default, debounce uses **leading mode** - the run executes with data from the **first** trigger.
876
+
877
+
With **trailing mode**, each subsequent trigger updates the run's data (payload, metadata, tags, maxAttempts, maxDuration, and machine), so the run executes with data from the **last** trigger:
878
+
879
+
```ts
880
+
// Leading mode (default): runs with first payload
0 commit comments