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

@@ -4,16 +4,16 @@ import (
core "git.yuntuo.hk/k2safe/orbit/model"
)
// PollRound 表示一次业务查询轮次,一轮对应一个 Pulse 任务。
// PollRound 表示一次激活内的业务查询轮次;人工恢复同轮会在新激活中关联新任务,旧记录保留。
// 对应表 weave_poll_rounds;这是服务端持久化模型,不直接作为 API 响应。
type PollRound struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// WorkflowID 所属流程实例标识。
WorkflowID core.ID `db:"workflow_id"`
// ActivationID 所属步骤激活,区分旧轮次和人工恢复后的新轮次。
// ActivationID 所属步骤激活;人工恢复可在新激活沿用同一业务轮编号。
ActivationID core.ID `db:"activation_id"`
// Round 本次激活内的查询轮次编号,从 1 开始。
// Round 从首次激活起连续的业务轮次;人工恢复同轮保留编号,通过ActivationID区分任务。
Round uint32 `db:"round"`
// TaskID 关联的 Pulse 任务标识。
TaskID core.ID `db:"task_id"`

View File

@@ -13,13 +13,17 @@ type PollState struct {
core.Record
// WorkflowID 所属流程实例标识。
WorkflowID core.ID `db:"workflow_id"`
// ActivationID 所属步骤激活,区分旧轮次和人工恢复后的新轮次。
// ActivationID 所属步骤激活;人工恢复可在新激活沿用同一业务轮编号。
ActivationID core.ID `db:"activation_id"`
// MaxRounds 业务查询最多轮次,不等于单轮请求重试次数。
MaxRounds uint32 `db:"max_rounds"`
// UsedRounds 已创建的查询轮次,重启或暂停继续不得重置。
// UsedRounds 从首次激活起已创建的业务轮次数;当前激活的本地行数需扣除FirstRound之前的历史。
UsedRounds uint32 `db:"used_rounds"`
// MaxAttemptsPerRound 每轮 Pulse 任务最多尝试数,包含该轮首次请求。
// FirstRound 本激活保存的首个业务查询轮次;恢复保留原编号,之前轮次仍留在旧激活。
FirstRound uint32 `db:"first_round"`
// FirstRoundAttemptsUsed 首个业务轮次在旧激活已用的执行尝试;从原单轮预算扣除,不能通过换激活重置。
FirstRoundAttemptsUsed uint32 `db:"first_round_attempts_used"`
// MaxAttemptsPerRound 每业务轮跨激活的Pulse尝试总上限,包含该轮首次请求。
MaxAttemptsPerRound uint32 `db:"max_attempts_per_round"`
// IntervalMS 相邻业务查询轮次的等待间隔,单位毫秒。
IntervalMS uint64 `db:"interval_ms"`