feat: show backup time in message
parent
9ce8199d5f
commit
90aa929b73
|
@ -84,6 +84,7 @@ impl ServerProcess {
|
||||||
// We wait some time to (hopefully) ensure the save-all call has completed
|
// We wait some time to (hopefully) ensure the save-all call has completed
|
||||||
std::thread::sleep(std::time::Duration::from_secs(10));
|
std::thread::sleep(std::time::Duration::from_secs(10));
|
||||||
|
|
||||||
|
let start_time = chrono::offset::Local::now();
|
||||||
let res = self.create_backup_archive();
|
let res = self.create_backup_archive();
|
||||||
|
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
|
@ -93,10 +94,20 @@ impl ServerProcess {
|
||||||
// The server's save feature needs to be enabled again even if the archive failed to create
|
// The server's save feature needs to be enabled again even if the archive failed to create
|
||||||
self.custom("save-on")?;
|
self.custom("save-on")?;
|
||||||
|
|
||||||
|
let duration = chrono::offset::Local::now() - start_time;
|
||||||
|
let duration_str = format!(
|
||||||
|
"{}m{}s",
|
||||||
|
duration.num_seconds() / 60,
|
||||||
|
duration.num_seconds() % 60
|
||||||
|
);
|
||||||
|
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
self.custom("say server backed up successfully")?;
|
self.custom(&format!("say server backed up in {}", duration_str))?;
|
||||||
} else {
|
} else {
|
||||||
self.custom("an error occured while backing up the server")?;
|
self.custom(&format!(
|
||||||
|
"an error occured after {} while backing up the server",
|
||||||
|
duration_str
|
||||||
|
))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
Loading…
Reference in New Issue