From b06f46ea7c6d457d3b408a94179fc4b5f4e48843 Mon Sep 17 00:00:00 2001 From: John Garland Date: Sun, 3 Jan 2010 16:27:05 +0000 Subject: [PATCH] Fix blocklist ignoring try_times. Make blocklist print error messages on failures. --- deluge/plugins/blocklist/blocklist/core.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/blocklist/blocklist/core.py index e0e2c59fe..479fa1286 100644 --- a/deluge/plugins/blocklist/blocklist/core.py +++ b/deluge/plugins/blocklist/blocklist/core.py @@ -276,7 +276,6 @@ class Core(CorePluginBase): if "Moved Permanently" in error_msg: log.debug("Setting blocklist url to %s", location) self.config["url"] = location - f.trap(f.type) d = self.download_list(url=location) d.addCallbacks(self.on_download_complete, self.on_download_error) else: @@ -285,13 +284,13 @@ class Core(CorePluginBase): self.up_to_date = True blocklist = deluge.configmanager.get_config_dir("blocklist.cache") d = threads.deferToThread(self.update_info, blocklist) - f.trap(f.type) - elif self.failed_attempts < self.config["try_times"]: - log.warning("Blocklist download failed!") - self.failed_attempts += 1 - f.trap(f.type) else: - log.error(error_msg) + log.warning("Blocklist download failed: %s", error_msg) + if self.failed_attempts < self.config["try_times"]: + log.debug("Let's try again") + self.failed_attempts += 1 + d = self.download_list() + d.addCallbacks(self.on_download_complete, self.on_download_error) return d def import_list(self, blocklist): @@ -379,8 +378,7 @@ class Core(CorePluginBase): try_again = True elif self.filename != cache and os.path.exists(cache): # If we have a backup and we haven't already used it - e = f.trap(Exception) - log.warning("Error reading blocklist: %s", e) + log.warning("Error reading blocklist: %s", f.getErrorMessage()) blocklist = cache try_again = True