diff options
author | Chase Sterling <chase.sterling@gmail.com> | 2022-02-02 00:21:54 -0500 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2022-02-06 16:45:37 +0000 |
commit | 2fb41341c94fe1d53c2c9d48e74e163c725c5857 (patch) | |
tree | 6f4925e552b0802fcdc24875ae01c8b4425eeff9 /deluge/core/core.py | |
parent | b76f2c0f207ae271fb1533b6f2ec91d2c9d5b92a (diff) | |
download | deluge-2fb41341c94fe1d53c2c9d48e74e163c725c5857.tar.gz deluge-2fb41341c94fe1d53c2c9d48e74e163c725c5857.tar.bz2 deluge-2fb41341c94fe1d53c2c9d48e74e163c725c5857.zip |
[Core] Convert inlineCallbacks to maybe_coroutine
Make logging functions synchronous.
They were not calling any async functions, and wrapping them in
maybe_coroutine caused reactor to be imported before gtkui could
install the gtk reactor.
Closes: https://github.com/deluge-torrent/deluge/pull/353
Diffstat (limited to 'deluge/core/core.py')
-rw-r--r-- | deluge/core/core.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py index 1090b0f2a..398e3584a 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -38,7 +38,7 @@ from deluge.core.pluginmanager import PluginManager from deluge.core.preferencesmanager import PreferencesManager from deluge.core.rpcserver import export from deluge.core.torrentmanager import TorrentManager -from deluge.decorators import deprecated +from deluge.decorators import deprecated, maybe_coroutine from deluge.error import ( AddTorrentError, DelugeError, @@ -498,13 +498,13 @@ class Core(component.Component): """ - @defer.inlineCallbacks - def add_torrents(): + @maybe_coroutine + async def add_torrents(): errors = [] last_index = len(torrent_files) - 1 for idx, torrent in enumerate(torrent_files): try: - yield self.add_torrent_file_async( + await self.add_torrent_file_async( torrent[0], torrent[1], torrent[2], save_state=idx == last_index ) except AddTorrentError as ex: @@ -769,14 +769,14 @@ class Core(component.Component): ) @export - @defer.inlineCallbacks - def get_torrents_status(self, filter_dict, keys, diff=False): + @maybe_coroutine + async def get_torrents_status(self, filter_dict, keys, diff=False): """ returns all torrents , optionally filtered by filter_dict. """ all_keys = not keys torrent_ids = self.filtermanager.filter_torrent_ids(filter_dict) - status_dict, plugin_keys = yield self.torrentmanager.torrents_status_update( + status_dict, plugin_keys = await self.torrentmanager.torrents_status_update( torrent_ids, keys, diff=diff ) # Ask the plugin manager to fill in the plugin keys |