#2250 closed patch (Fixed)
Speedup removing multiple torrents from core
Reported by: | Bro | Owned by: | Bro |
---|---|---|---|
Priority: | minor | Milestone: | 2.0.0 |
Component: | Core | Version: | develop |
Keywords: | Cc: |
Description
Each call to core.remove_torrent took about 1 second on my machine. Most of time 90%+ was used by writing the state file. When removing multiple torrents, the state file is now written after removing all the torrents.
https://github.com/bendikro/deluge/commit/master-core-remove-torrents
Change History (10)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Good point andar. I've readded the remove_torrent method: https://github.com/bendikro/deluge/commits/master-core-remove-torrents2
comment:3 by , 12 years ago
Updated with comments from gazpachoking: https://github.com/bendikro/deluge/commit/master-core-remove-torrents3
comment:4 by , 12 years ago
Fixed tests and updated with changes in develop branch: https://github.com/bendikro/deluge/commit/develop-core-remove-torrents
comment:5 by , 12 years ago
A few notes:
remove_all()
is a misleading function name, maybe on_remove_torrents() and also change remove_torrent() for on_remove_torrent()?- This import should be at top:
from twisted.internet import reactor, task
- the docstring in core.remove_torrents needs updated
- torrentmanager.remove() method should be renamed to remove_torrents, it's not descriptive enough (easily confused with list.remove()). Also the method requires an updated docstring.
- The type check in torrentmanager.remove() should be changed so it raises an exception if it's not a list however maybe just remove it as all remove methods should go through core for clients and we can verify that other calls in core use the torrentmanager method correctly.
- We discussed in IRC whether the clients need to know (or care) why a torrent could not be removed, I can't remember the conclusion but do need to verify whether current clients can handle this change e.g. webui.
comment:6 by , 10 years ago
Believe this is ready: https://github.com/deluge-torrent/deluge/pull/14
comment:7 by , 10 years ago
Milestone: | performance → 2.0 |
---|---|
Owner: | set to |
Status: | new → assigned |
Version: | master (git) → develop (git) |
comment:8 by , 10 years ago
Added to develop: [08363f28dd308]
Should be straightforward for Console and WebUI to utilise this too. I will link a branch/pull request shortly.
comment:9 by , 10 years ago
Resolution: | → Fixed |
---|---|
Status: | assigned → closed |
Added Console and Web code to develop [faf3f963222b1]
You probably shouldn't just remove core.remove_torrent().. Keep it but just call core.remove_torrents() from it with [torrent_id].
If you remove that function you'll likely break other UIs any user written scripts.