Skip to content

feat(server): automatic snapshot scheduling - #300

Merged
kacy merged 1 commit into
mainfrom
feat/snapshot-scheduling
Feb 25, 2026
Merged

feat(server): automatic snapshot scheduling#300
kacy merged 1 commit into
mainfrom
feat/snapshot-scheduling

Conversation

@kacy

@kacy kacy commented Feb 25, 2026

Copy link
Copy Markdown
Owner

summary

adds save-interval-secs config option (and --save-interval CLI flag / EMBER_SAVE_INTERVAL env var) to trigger background snapshots on a schedule.

when set to a non-zero value, a background task wakes every N seconds, broadcasts ShardRequest::Snapshot to all shards (identical to BGSAVE), and updates last_save_timestamp so INFO persistence stays accurate.

defaults to 0 (disabled), matching current behavior — no regression for existing deployments.

what was tested

  • cargo build -p ember-server clean with no warnings
  • cargo clippy -p ember-server -- -D warnings passes
  • both run_threaded and run_concurrent code paths wired — verified by reading the function signatures
  • default value 0 means the background task is never spawned unless explicitly enabled

design considerations

the background task uses tokio::time::sleep in a loop rather than tokio::time::interval — this means save N seconds elapse after the previous save completes, preventing overlapping saves under a slow disk.

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.
@kacy
kacy merged commit b3fec6c into main Feb 25, 2026
@kacy
kacy deleted the feat/snapshot-scheduling branch February 25, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant