Add schedule_timer_until absolute-deadline timer#37
Open
pinodeca wants to merge 1 commit into
Open
Conversation
Add OrchestrationContext::schedule_timer_until(deadline), an absolute wall-clock deadline timer variant that complements the existing relative schedule_timer. A deadline already in the past fires immediately. The change is purely additive: it reuses the existing timer future and replay path via a shared schedule_timer_at_ms helper, with no changes to the action/event schema, the provider's visible_at handling, or replay semantics. Closes #34
57634ff to
28cc21e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34.
Summary
Adds
OrchestrationContext::schedule_timer_until(deadline: std::time::SystemTime)— an absolute wall-clock deadline timer that complements the existing relativeschedule_timer(delay).This matches domains where the target is intrinsically an absolute timestamp (cron ticks, SLAs, scheduled-at times — e.g. pg_durable's
wait_for_schedule), removing the manualdeadline - nowclamp and the extra recordedutc_nowreading the relative form requires.Implementation
deadlineto ms-since-epoch and emitsAction::CreateTimer { fire_at_ms }directly, reusing the existing timer future/replay path.fire_at_ms = 0, firing immediately on the next turn.schedule_timerandschedule_timer_untilnow share a privateschedule_timer_at_mshelper, keeping a single timer code path.Backwards compatibility
Purely additive. No changes to existing signatures, the on-history action/event schema (
Action::CreateTimer/TimerCreatedalready store an absolutefire_at_ms), the provider'svisible_athandling, or replay semantics. Safe for rolling/mixed-version clusters.Tests
schedule_timer_until_fires_at_deadline— fires at an absolute deadline.schedule_timer_until_past_deadline_fires_immediately— past deadline fires immediately.Validated with
cargo nt,cargo clippy --all-targets --all-features(clean), andcargo test --doc.