mirror of https://github.com/raftario/filite.git
Fix DB related bugs
This commit is contained in:
parent
8a704eb283
commit
212ac3617f
10
src/main.rs
10
src/main.rs
|
@ -50,10 +50,12 @@ fn main() {
|
|||
|
||||
let pool = setup::create_pool(&config.database_url, config.pool_size);
|
||||
#[cfg(not(feature = "dev"))]
|
||||
embedded_migrations::run(&pool.get().unwrap()).unwrap_or_else(|e| {
|
||||
eprintln!("Can't prepare database: {}.", e);
|
||||
process::exit(1);
|
||||
});
|
||||
{
|
||||
embedded_migrations::run(&pool.get().unwrap()).unwrap_or_else(|e| {
|
||||
eprintln!("Can't prepare database: {}.", e);
|
||||
process::exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
let password_hash = {
|
||||
#[cfg(feature = "dev")]
|
||||
|
|
|
@ -99,7 +99,13 @@ impl Default for Config {
|
|||
.expect("Can't convert database path to string")
|
||||
.to_owned()
|
||||
};
|
||||
let pool_size = num_cpus::get() as u32 / 2;
|
||||
let pool_size = {
|
||||
let n = num_cpus::get() as u32 / 2;
|
||||
match n < 1 {
|
||||
true => 1,
|
||||
false => n,
|
||||
}
|
||||
};
|
||||
let files_dir = {
|
||||
let mut path = get_data_dir();
|
||||
path.push("files");
|
||||
|
|
Loading…
Reference in New Issue