Skip to content

Commit

Permalink
periodic checkpoint: Don't checkpoint at startup
Browse files Browse the repository at this point in the history
Currently there's no way to disable checkpoint but one can
emulate it by enabling periodic checkpoint with really long
interval between checkpoints.

Unfortunately, current implementation runs checkpoint first
before waiting for the interval to pass.

This change makes the periodic checkpoint to first wait
and only after that checkpoint.

Signed-off-by: Piotr Jastrzebski <[email protected]>
  • Loading branch information
haaawk committed Dec 16, 2024
1 parent f8954db commit 163e369
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libsql-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ where
tracing::info!("setting checkpoint interval to {:?}", period);
let mut interval = interval(period);
interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
// Make sure that we don't checkpoint immediately after startup
interval.tick().await;
let mut retry: Option<Duration> = None;
loop {
if let Some(retry) = retry.take() {
Expand Down

0 comments on commit 163e369

Please sign in to comment.