mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 09:05:33 +00:00
update comments
This commit is contained in:
parent
d9e7674907
commit
63dbaa9dda
1 changed files with 8 additions and 6 deletions
|
|
@ -31,7 +31,8 @@ impl Preload {
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
/// Persist torrent bytes and preloaded content, cleanup tmp (see rqbit#408)
|
/// Persist torrent bytes and preloaded content,
|
||||||
|
/// cleanup tmp data on success (see rqbit#408)
|
||||||
pub fn commit(
|
pub fn commit(
|
||||||
&self,
|
&self,
|
||||||
info_hash: &str,
|
info_hash: &str,
|
||||||
|
|
@ -71,19 +72,20 @@ impl Preload {
|
||||||
n.to_string_lossy(),
|
n.to_string_lossy(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// move `persist_files` from temporary to permanent location
|
||||||
fs::create_dir_all(n.parent().unwrap())?;
|
fs::create_dir_all(n.parent().unwrap())?;
|
||||||
fs::rename(&o, &n)?;
|
fs::rename(&o, &n)?;
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"persist tmp file `{}` to `{}`",
|
"persist tmp file `{}` to `{}`",
|
||||||
o.to_string_lossy(),
|
o.to_string_lossy(),
|
||||||
n.to_string_lossy()
|
n.to_string_lossy()
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cleanup temporary files
|
// cleanup temporary data
|
||||||
let t = self.tmp(info_hash, false)?;
|
let tmp = self.tmp(info_hash, false)?;
|
||||||
if t.exists() {
|
if tmp.exists() {
|
||||||
fs::remove_dir_all(&t)?;
|
fs::remove_dir_all(&tmp)?;
|
||||||
log::debug!("clean tmp data `{}`", t.to_string_lossy())
|
log::debug!("clean tmp data `{}`", t.to_string_lossy())
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue