mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
persist torrent bytes to file on the last step
This commit is contained in:
parent
52a4ff2d44
commit
553bffb4f0
1 changed files with 4 additions and 4 deletions
|
|
@ -41,10 +41,6 @@ impl Preload {
|
||||||
persist_files: Option<HashSet<PathBuf>>,
|
persist_files: Option<HashSet<PathBuf>>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
validate_info_hash(info_hash)?;
|
validate_info_hash(info_hash)?;
|
||||||
// persist torrent bytes to file
|
|
||||||
let t = self.torrent(info_hash);
|
|
||||||
fs::write(&t, torrent_bytes)?;
|
|
||||||
log::debug!("persist torrent bytes for `{}`", t.to_string_lossy());
|
|
||||||
// persist preload files
|
// persist preload files
|
||||||
let mut d = PathBuf::from(&self.root);
|
let mut d = PathBuf::from(&self.root);
|
||||||
d.push(info_hash);
|
d.push(info_hash);
|
||||||
|
|
@ -90,6 +86,10 @@ impl Preload {
|
||||||
fs::remove_dir_all(&tmp)?;
|
fs::remove_dir_all(&tmp)?;
|
||||||
log::debug!("clean tmp data `{}`", tmp.to_string_lossy())
|
log::debug!("clean tmp data `{}`", tmp.to_string_lossy())
|
||||||
}
|
}
|
||||||
|
// persist torrent bytes to file (on previous operations success)
|
||||||
|
let t = self.torrent(info_hash);
|
||||||
|
fs::write(&t, torrent_bytes)?;
|
||||||
|
log::debug!("persist torrent bytes for `{}`", t.to_string_lossy());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue