Skip to main content

resolve_schedule_defaults_into_task

Function resolve_schedule_defaults_into_task 

Source
pub(crate) fn resolve_schedule_defaults_into_task(
    task: &mut CreateFlowTask,
    prev_flow_info: Option<&FlowInfoValue>,
) -> Result<()>
Expand description

Resolve FlowScheduleConfig into task.eval_schedule.

This must be called in on_prepare after prev_flow_info is loaded so that CreateRequest and FlowInfoValue both see the same resolved defaults.

The function is idempotent: if task.eval_schedule is already Some, it returns immediately (important for procedure retry / dump-restore).

The schedule phase (anchor) is the EVAL OFFSET value: boundaries are offset + k * interval (Unix epoch seconds), independent of timezone/DST. An omitted offset means zero. It is NOT anchored to create time and does not drift. Schedule configuration is NOT read from task.flow_options (those keys are no longer user-facing options).

For OR REPLACE, the previous typed config is preserved when interval+offset are unchanged; otherwise the schedule is recomputed.

Fallible: if the next phase boundary cannot fit in i64 (extremely far future), an explicit error is returned and flow creation fails instead of silently clamping to a non-phase timestamp.