Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too much time taken to add a torrent #297

Open
letscagefdn opened this issue Jan 9, 2025 · 1 comment
Open

too much time taken to add a torrent #297

letscagefdn opened this issue Jan 9, 2025 · 1 comment

Comments

@letscagefdn
Copy link

letscagefdn commented Jan 9, 2025

Hey,

It takes around 35 seconds to add a torrent. anything. I can fix on the options ?

`      let t1 = chrono::Utc::now().timestamp();
      let options = AddTorrentOptions {
          paused: true,
          only_files_regex: None,
          only_files: None,
          overwrite: true,
          list_only: true,
          output_folder: None,
          sub_folder: None,
          peer_opts: None,
          force_tracker_interval: None,
          disable_trackers: false,
          ratelimits: LimitsConfig::default(),
          initial_peers: None,
          preferred_id: None,
          storage_factory: None,
          defer_writes: None,
          trackers: None
      };

let managed_torrent_handle = tsession.add_torrent(
    AddTorrent::from_url("magnet?somenastytorrenthere"),
    Some(options)
).await.unwrap();
let t2 = chrono::Utc::now().timestamp();
println!("Time taken: {}", t2 - t1);`
@ikatson
Copy link
Owner

ikatson commented Jan 10, 2025

It's just the time to resolve the magnet through DHT/trackers. It's as slow as finding + connecting to peers of particular torrent is. It may even hang forever if there's no peers.

What's the issue with it though? Can you design your usage around it? E.g. just tokio::spawn(async {...add_torrent()}) or smth.

There's an unfinished branch with "deferred" flag where adding the torrent is instant btw. The only difference is that it let's you have a TorrentHandle before the torrent is resolved. But I'm not sure if this would resolve your confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants