Skip to content

Dispatch Log & Missed-Run Recovery #5

@niteshpurohit

Description

@niteshpurohit

Feature Request

Description

Track dispatched (key, fire_time) pairs and recover missed runs after downtime.

Use Case

If the scheduler was down, it should enqueue the missed ticks within the lookback window to keep data/jobs current.

Proposed Solution

  • Implement RailsCrons::DispatchLog that records successful dispatch decisions per (key, fire_time).
  • Backends:
    • Redis: ephemeral keys with TTL.
    • Postgres: table with (key, fire_time) unique index.
    • File: filesystem-safe hash files.
  • During each tick, compute expected fire times in the recovery window; enqueue those not found in the dispatch log (subject to locking).

Alternatives Considered

Pure lock-based idempotency — not sufficient for catch-up behavior.

Additional Context

Ensure pruning to avoid unbounded growth; TTL or periodic cleanup rake task.

Checklist

  • I have searched for a similar feature request and didn't find any duplicates.
  • I have included all the required information.
  • I have tagged the issue with the label "enhancement".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions