refactor(scheduler): async save worker + test consolidation#152
Merged
Conversation
The 3-day window was wired into two unrelated paths: cron expression parsing rejected anything whose next fire was >3d out, and the tick loop garbage-collected non-durable tasks after 3d. The parse-time check made legitimate weekly/monthly cron unusable (e.g. `0 9 * * 1` created after this week's Monday fire), and the runtime GC was a heuristic with no clear value once durable tasks were already exempt. Replace the parse-time window with a never-fires check (e.g. Feb 30) and remove the runtime expiry entirely — tasks now live until they are explicitly deleted, or (for one-shots) until they fire.
Extract disk I/O from mutation paths into a dedicated save worker: - SaveMessage queue decouples tasks.write from fsync latency - Barrier API for test synchronization (wait_idle) - Retry via dirty flag on transient failures Consolidate test infrastructure: - Shared MockStorage for persistence tests - Remove duplicated test helpers across files
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.
Summary
wait_idle()barrier API for test synchronizationMockStorageChanges
crates/loopal-scheduler/src/save_worker.rs— new async save workercrates/loopal-scheduler/src/scheduler.rs— integrate save worker channelcrates/loopal-scheduler/src/tick.rs— use save worker instead of inline I/Ocrates/loopal-scheduler/tests/suite/mock_storage.rs— shared test helperTest plan
bazel test //crates/loopal-scheduler:suitepassesbazel build //... --config=clippypasses