mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-02-11 13:04:06 +01:00
flush+sync the version file just in case
This commit is contained in:
parent
ae1d7f4d9b
commit
8c5856007c
@ -1,5 +1,5 @@
|
|||||||
use std::fs;
|
use std::fs::{self, File};
|
||||||
use std::io::{self, ErrorKind};
|
use std::io::{self, ErrorKind, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use milli::heed;
|
use milli::heed;
|
||||||
@ -23,7 +23,10 @@ pub fn create_version_file(
|
|||||||
patch: &str,
|
patch: &str,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
let version_path = db_path.join(VERSION_FILE_NAME);
|
let version_path = db_path.join(VERSION_FILE_NAME);
|
||||||
fs::write(version_path, format!("{}.{}.{}", major, minor, patch))
|
let mut file = File::create(&version_path)?;
|
||||||
|
file.write_all(format!("{}.{}.{}", major, minor, patch).as_bytes())?;
|
||||||
|
file.flush()?;
|
||||||
|
file.sync_all()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_version(db_path: &Path) -> Result<(u32, u32, u32), VersionFileError> {
|
pub fn get_version(db_path: &Path) -> Result<(u32, u32, u32), VersionFileError> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user