Skip to content

refactor(reminders): use IWithTimers for execution backstops - #1822

Merged
Aaronontheweb merged 2 commits into
devfrom
refactor/reminder-execution-timers
Aug 8, 2026
Merged

refactor(reminders): use IWithTimers for execution backstops#1822
Aaronontheweb merged 2 commits into
devfrom
refactor/reminder-execution-timers

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

Refactor ReminderExecutionActor off Context.System.Scheduler to IWithTimers — same rule applied to PR #1821.

Change

Both one-shot scheduler timers become Timers.StartSingleTimer with distinct keys:

  • Execution attempt timeout (ExecutionAttemptTimeoutReached) — armed in PreStart
  • Delivery-observed backstop (DeliveryBackstopTimeout) — armed in BeginAwaitingDeliveryResult

Timers.Cancel replaces the manual ICancelable cancellation on the delivery-observed and settlement paths. IWithTimers cancels timers automatically on actor stop, so the PostStop bookkeeping for both ICancelable fields is deleted.

Why

  • Timers are tied to the actor lifecycle — a stopped actor can never have a stray timer fire (relevant to the ExecutionStarted dead-letter class of noise).
  • Removes manual ICancelable null-tracking; less bookkeeping, no leak path.
  • Deterministic and testable via the injected ITimerScheduler.

Verification

No behavioral change: same messages, same delays (ExecutionAttemptTimeout, DeliveryObservedTimeout). 173 reminder tests green; slopwatch 0; headers clean.

Replace both Context.System.Scheduler.ScheduleTellOnceCancelable one-shot
timers (execution attempt timeout, delivery-observed backstop) with the
actor's injected ITimerScheduler via IWithTimers:

- StartSingleTimer arms each backstop; distinct timer keys keep them
  independent.
- Timers.Cancel replaces the manual ICancelable cancellation on the
  delivery-observed and settlement paths.
- IWithTimers cancels timers automatically on actor stop, so the PostStop
  bookkeeping for the two ICancelable fields is gone entirely.

No behavioral change: same messages, same delays (ExecutionAttemptTimeout,
DeliveryObservedTimeout). 173 reminder tests green; slopwatch 0; headers
clean.
@Aaronontheweb Aaronontheweb added reminders Reminder scheduling, execution, and history refactoring labels Aug 8, 2026

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 8, 2026 21:51
@Aaronontheweb
Aaronontheweb merged commit 16671f2 into dev Aug 8, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the refactor/reminder-execution-timers branch August 8, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring reminders Reminder scheduling, execution, and history

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant