feat: recover workflow waits within original deadlines
This commit is contained in:
@@ -61,10 +61,6 @@ func (r *WorkflowRuntime) advanceClock(ctx context.Context, tx *sql.Tx, g *workf
|
||||
}
|
||||
return false, deleteWorkflowClock(ctx, tx, g, row)
|
||||
}
|
||||
var activated time.Time
|
||||
if err := tx.QueryRowContext(ctx, `SELECT created_at FROM weave_activations WHERE namespace_id=? AND id=? AND workflow_id=? AND step_id=?`, c.ns, checkpoint.ActivationID, c.workflow, step).Scan(&activated); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if checkpoint.Kind == "POLL" {
|
||||
node, _ := g.program.Step(row.view.Key)
|
||||
if node.Poll.FinalSignal != nil {
|
||||
@@ -103,7 +99,11 @@ func (r *WorkflowRuntime) advanceClock(ctx context.Context, tx *sql.Tx, g *workf
|
||||
return false, err
|
||||
}
|
||||
node, _ := g.program.Step(row.view.Key)
|
||||
intended := activated.Add(time.Duration(node.Timer.DelayMS) * time.Millisecond)
|
||||
origin, err := workflowActivationOrigin(ctx, tx, g, row)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
intended := origin.started.Add(time.Duration(node.Timer.DelayMS) * time.Millisecond)
|
||||
if kind != "TIMER" || state != "WAITING" || name.Valid || version.Valid || len(correlation) != 0 || !deadline.Equal(minimumTime(intended, g.view.DeadlineAt)) {
|
||||
return false, errors.New("workflow timer wait invalid")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user