mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Merge #1238
1238: fix snapshot temp file r=curquiza a=MarinPostma fix snapshot creating a temp file in /tmp, and create the temp file in the snapshot directory instead. close #1237 Co-authored-by: mpostma <postma.marin@protonmail.com>
This commit is contained in:
commit
0a0eee4993
1 changed files with 8 additions and 8 deletions
|
@ -6,7 +6,7 @@ use log::error;
|
||||||
use std::fs::create_dir_all;
|
use std::fs::create_dir_all;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{Duration};
|
use std::time::Duration;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
pub fn load_snapshot(
|
pub fn load_snapshot(
|
||||||
|
@ -29,7 +29,7 @@ pub fn load_snapshot(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_snapshot(data: &Data, snapshot_path: &Path) -> Result<(), Error> {
|
pub fn create_snapshot(data: &Data, snapshot_path: &Path) -> Result<(), Error> {
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new_in(snapshot_path)?;
|
||||||
|
|
||||||
data.db.copy_and_compact_to_path(tmp_dir.path())?;
|
data.db.copy_and_compact_to_path(tmp_dir.path())?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue