Skip to content

Commit

Permalink
Improving interval delay and checkpointing wal
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpert committed Oct 10, 2022
1 parent d933ac9 commit af04fbf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion db/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ func (conn *SqliteStreamDB) BackupTo(bkFilePath string) error {
}
defer src.Close()

err = performCheckpoint(goqu.New("sqlite", sqlDB))
if err != nil {
return err
}

_, err = src.Exec("VACUUM main INTO ?;", []driver.Value{bkFilePath})
if err != nil {
return err
Expand Down Expand Up @@ -382,7 +387,7 @@ func performCheckpoint(gSQL *goqu.Database) error {
Int64("checkpoint", rCheckpoint).
Msg("Waiting checkpoint...")

time.Sleep(500 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
}
}

Expand Down

0 comments on commit af04fbf

Please sign in to comment.