Hi Temporal community,
I’m experiencing unexpected behavior with date handling in a parent-child workflow pattern and would appreciate any insights.
Setup
-
Parent Workflow A: Long-running workflow that orchestrates multiple child workflows
-
Child Workflows: 1000+ child workflows, each processing ~5 minutes per activity
-
Total execution time: Spans across midnight (starts one day, finishes the next)
Expected Behavior
// Parent workflow - called ONCE at the top
currentDate := getCurrentDate() // Returns "2025-05-01"
// Loop to start child workflows
for i := 0; i < 1000; i++ {
childWorkflow.Start(currentDate) // Should always pass "2025-05-01"
}
Actual Behavior
-
First batch of child workflows receive 2025-05-01
-
Later child workflows (after midnight) receive 2025-05-02
Questions
-
Why is the date changing? I only call getCurrentDate() once at the parent level and pass the same variable to all children.
-
Is this related to Temporal’s replay mechanism? Could workflow replay be re-executing the date capture logic?
-
Determinism concerns? Should I be using workflow.Now() instead of a custom getCurrentDate() function?