Design a service that accepts jobs to run at a specified future time and dispatches them when they become due.
### Clarifying Questions
The reported prompt names a delayed job scheduler without a concrete workload or delivery contract. Clarify scheduling precision, job volume, payload size, retry policy, cancellation, and whether duplicate execution is acceptable. For the worked architecture, choose durable schedules and at-least-once dispatch with idempotent execution. These are explicit design choices rather than reported requirements.
### What a Strong Answer Covers
A schedule data model, due-time indexing, concurrent claiming, dispatch and execution boundaries, crash recovery, retries, time handling, and operational visibility. Explain how the system handles a new earlier job while a dispatcher waits.
### Follow-up Questions
- How would cancellation race with a dispatcher that already claimed a job?
- What can be guaranteed if a worker performs an external side effect and then crashes before acknowledging it?
- When would a timing wheel or partitioned due-time queue be appropriate?
Overview: Design durable delayed-job scheduling with due-time lookup, concurrent claims, and crash recovery. Make delivery semantics explicit and cover retries, cancellation races, clock handling, and scheduling lag.
Design a service that accepts jobs to run at a specified future time and dispatches them when they become due.
Clarifying Questions Guidance
The reported prompt names a delayed job scheduler without a concrete workload or delivery contract. Clarify scheduling precision, job volume, payload size, retry policy, cancellation, and whether duplicate execution is acceptable. For the worked architecture, choose durable schedules and at-least-once dispatch with idempotent execution. These are explicit design choices rather than reported requirements.
What a Strong Answer Covers Guidance
A schedule data model, due-time indexing, concurrent claiming, dispatch and execution boundaries, crash recovery, retries, time handling, and operational visibility. Explain how the system handles a new earlier job while a dispatcher waits.
Follow-up Questions Guidance
How would cancellation race with a dispatcher that already claimed a job?
What can be guaranteed if a worker performs an external side effect and then crashes before acknowledging it?
When would a timing wheel or partitioned due-time queue be appropriate?