write db on termination

This commit is contained in:
Naim A 2019-01-17 00:53:23 +02:00
parent 73416c886f
commit d5b8a4a858
No known key found for this signature in database
GPG key ID: FD7948915D9EF8B9

View file

@ -77,9 +77,10 @@ fn signal_termination() {
} }
fn main() { fn main() {
let parser = clap::App::new("udpt") let parser = clap::App::new(env!("CARGO_PKG_NAME"))
.about("High performance, lightweight, udp based torrent tracker.") .about(env!("CARGO_PKG_DESCRIPTION"))
.author("Naim A. <naim94a@gmail.com>") .author(env!("CARGO_PKG_AUTHORS"))
.version(env!("CARGO_PKG_VERSION"))
.arg( .arg(
clap::Arg::with_name("config") clap::Arg::with_name("config")
.takes_value(true) .takes_value(true)
@ -229,4 +230,10 @@ fn main() {
let _ = thread.join(); let _ = thread.join();
} }
} }
if let Some(db_path) = cfg.get_db_path() {
info!("running final cleanup & saving database...");
tracker.periodic_task(db_path.as_str());
}
info!("goodbye.");
} }