clockworklabs / clockworklabs/SpacetimeDB
Handling Missed Scheduled Reducer Executions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
We currently do not persist the last execution time of scheduled reducers. As a result, events such as module updates, server restarts, or leader changes (anything that make SchedulerActor to restart) cause the next execution slot to be scheduled from "now" instead of the last known execution time.
This behavior is somewhat similar to tokio::time::MissedTickBehavior::Delay and seems reasonable when scheduled reducer actually miss their execution time slot due to any of the above mentioned events. However, it becomes unexpected in scenarios when SchedulerActor restarts qucikly and a scheduled reducer have not missed their execution time but drifted forward unneccesarily.
What should be the expected behavior?
- Keep it like
tokio::time::MissedTickBehavior::Delaybut do not drift reducer who has not missed their ticks. - Make behaviour configurable by user?
- Let it be like thism, and update the same in documentation?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the SchedulerActor scheduling flow and how scheduled reducer execution times are currently handled across restarts, updates, and leader changes. The expected missed-tick and drift behavior must be decided first; done would require an agreed behavior, implementation, and tests covering the restart scenarios described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100