Skip to main content

command_budget

Function command_budget 

Source
pub fn command_budget(
    deadline: Option<DateTime<Utc>>,
    lease_expires_at: DateTime<Utc>,
) -> DateTime<Utc>
Expand description

Per-command execution budget: min(envelope.deadline, lease_expiry − [LEASE_SAFETY_MARGIN]). The LEASE bound is clamped to now; an already-past deadline is not — it yields a zero budget and an immediate HANDLER_TIMEOUT, which is the correct outcome for a command delivered after its deadline. There is no lease-renew call in the protocol, so the safety-margined lease expiry always bounds the budget. Twin of the TypeScript receiver’s commandBudget.