feat(server): automatic snapshot scheduling - #300
Merged
Conversation
adds save-interval-secs config option and --save-interval CLI flag. when set to a non-zero value, a background task triggers BGSAVE every N seconds and updates last_save_timestamp. both sharded and concurrent modes are supported. defaults to 0 (disabled) to match current behavior.
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
adds
save-interval-secsconfig option (and--save-intervalCLI flag /EMBER_SAVE_INTERVALenv var) to trigger background snapshots on a schedule.when set to a non-zero value, a background task wakes every N seconds, broadcasts
ShardRequest::Snapshotto all shards (identical toBGSAVE), and updateslast_save_timestampsoINFO persistencestays accurate.defaults to
0(disabled), matching current behavior — no regression for existing deployments.what was tested
cargo build -p ember-serverclean with no warningscargo clippy -p ember-server -- -D warningspassesrun_threadedandrun_concurrentcode paths wired — verified by reading the function signatures0means the background task is never spawned unless explicitly enableddesign considerations
the background task uses
tokio::time::sleepin a loop rather thantokio::time::interval— this means save N seconds elapse after the previous save completes, preventing overlapping saves under a slow disk.