From 163e3697f5a3fa03e284a7c729fb57023a2a5aba Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Mon, 16 Dec 2024 18:02:47 +0100 Subject: [PATCH] periodic checkpoint: Don't checkpoint at startup 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 --- libsql-server/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsql-server/src/lib.rs b/libsql-server/src/lib.rs index 2b4caec4cd..edc294c75e 100644 --- a/libsql-server/src/lib.rs +++ b/libsql-server/src/lib.rs @@ -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 = None; loop { if let Some(retry) = retry.take() {