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: .cursor/rules/CADENCE-WORKFLOWS.mdc
+26-33Lines changed: 26 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Follow these rules to ensure deterministic, reliable, and maintainable Cadence w
13
13
14
14
Never iterate directly over Go maps in Cadence workflows. The iteration order is random and breaks determinism required for workflow replay. Always sort map keys before iterating.
Do not use native Go goroutines inside Cadence workflows. Use `workflow.Go` to create Cadence-managed concurrent threads for deterministic execution and replay.
Do not launch many activities or child workflows concurrently without limiting concurrency. Use a non-blocking pattern (similar to array) to control parallelism and avoid overwhelming workers.
68
68
69
-
**Good Example:**
69
+
**USE**
70
70
```go
71
-
const maxConcurrent = 3
72
-
var futures []workflow.Future
73
-
sem := 0
71
+
const batchSize = 3
72
+
var futures []func(ctx workflow.Context) workflow.Future
Do not reuse the same workflow-id for frequent or continuous runs. This can cause hot shard problems. Use unique or distributed workflow-ids to spread load evenly.
Always register workflows and activities with explicit string names and use those names when starting them. This improves decoupling and ensures consistent communication between workers and clients.
0 commit comments