mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 09:05:33 +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>>,
|
||||
) -> Result<()> {
|
||||
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
|
||||
let mut d = PathBuf::from(&self.root);
|
||||
d.push(info_hash);
|
||||
|
|
@ -90,6 +86,10 @@ impl Preload {
|
|||
fs::remove_dir_all(&tmp)?;
|
||||
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(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue