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

Updated libtorrent session creation to be async #8112

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

qstokkink
Copy link
Contributor

Fixes #8060

This PR:

  • Updates DownloadManager.ltsessions to store futures instead of completed sessions.

@qstokkink qstokkink force-pushed the upd_dlmngr_session_futures branch from aa9ef3f to b05fd19 Compare August 23, 2024 08:30
@qstokkink qstokkink changed the title WIP: Updated libtorrent session creation to be async READY: Updated libtorrent session creation to be async Aug 23, 2024
@qstokkink qstokkink marked this pull request as ready for review August 23, 2024 08:38
@qstokkink qstokkink marked this pull request as draft August 23, 2024 11:06
@qstokkink qstokkink changed the title READY: Updated libtorrent session creation to be async WIP: Updated libtorrent session creation to be async Aug 23, 2024
@qstokkink qstokkink force-pushed the upd_dlmngr_session_futures branch 4 times, most recently from 50f0822 to 541e7b2 Compare August 23, 2024 11:34
@qstokkink qstokkink changed the title WIP: Updated libtorrent session creation to be async READY: Updated libtorrent session creation to be async Aug 23, 2024
@qstokkink qstokkink marked this pull request as ready for review August 23, 2024 11:40
Copy link
Member

@egbertbouman egbertbouman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, but maybe you can remove some of the add_done_callback calls in favor of awaiting? There are definitely some cases where you can avoid its use. Some (untested) ideas:

  • make initialize async (shouldn't be a problem, since it's called by Session.start)
  • make _request_torrent_updates async (shouldn't be a problem, since it's only called using the TaskManager)
  • make set_download_rate_limit async (although you'll have to use TaskManager in DownloadManager.__init__)
  • use await in DownloadManager.shutdown
  • use await in DownloadManager.remove_download

@qstokkink qstokkink changed the title READY: Updated libtorrent session creation to be async WIP: Updated libtorrent session creation to be async Sep 2, 2024
@qstokkink qstokkink marked this pull request as draft September 2, 2024 08:25
@qstokkink qstokkink force-pushed the upd_dlmngr_session_futures branch from 541e7b2 to 27e6f10 Compare September 2, 2024 09:23
@qstokkink qstokkink force-pushed the upd_dlmngr_session_futures branch from 27e6f10 to ddc4144 Compare September 2, 2024 09:24
@qstokkink qstokkink changed the title WIP: Updated libtorrent session creation to be async READY: Updated libtorrent session creation to be async Sep 2, 2024
@qstokkink qstokkink marked this pull request as ready for review September 2, 2024 09:37
@qstokkink
Copy link
Contributor Author

@egbertbouman I implemented your suggestions. In addition, I made set_upload_rate_limit similar to set_download_rate_limit.

I validated locally that downloading still works, even after shutting down and restarting Tribler.

@qstokkink qstokkink changed the title READY: Updated libtorrent session creation to be async Updated libtorrent session creation to be async Sep 2, 2024
@qstokkink qstokkink merged commit 7d7c943 into Tribler:main Sep 2, 2024
7 checks passed
@qstokkink qstokkink deleted the upd_dlmngr_session_futures branch September 2, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants