feat: recover poll activations within original round budgets

This commit is contained in:
2026-09-18 05:40:08 +08:00
parent 1d1a441167
commit 56b9a2ccfe
32 changed files with 1051 additions and 65 deletions

View File

@@ -61,7 +61,7 @@ func appendWorkflowResult(ctx context.Context, tx *sql.Tx, ns, eventID, taskID c
return errors.New("poll activation cannot own a direct task")
}
var round uint32
err = tx.QueryRowContext(ctx, `SELECT r.round FROM weave_poll_rounds r JOIN weave_poll_states p ON p.namespace_id=r.namespace_id AND p.workflow_id=r.workflow_id AND p.activation_id=r.activation_id WHERE r.namespace_id=? AND r.workflow_id=? AND r.activation_id=? AND r.task_id=? AND r.round BETWEEN 1 AND p.used_rounds`, ns, workflow, ownerID, taskID).Scan(&round)
err = tx.QueryRowContext(ctx, `SELECT r.round FROM weave_poll_rounds r JOIN weave_poll_states p ON p.namespace_id=r.namespace_id AND p.workflow_id=r.workflow_id AND p.activation_id=r.activation_id WHERE r.namespace_id=? AND r.workflow_id=? AND r.activation_id=? AND r.task_id=? AND r.round BETWEEN p.first_round AND p.used_rounds`, ns, workflow, ownerID, taskID).Scan(&round)
if errors.Is(err, sql.ErrNoRows) {
return errors.New("workflow poll task association invalid")
}