Make blocklist p...
Content-type: text/plain
Author: johnnyg
Revision: 6075
Log:
Fix blocklist ignoring try_times.
Make blocklist print error messages on failures.
Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog 2010-01-03 01:37:57 UTC (rev 6074)
+++ branches/1.2_RC/ChangeLog 2010-01-03 16:27:05 UTC (rev 6075)
@@ -24,6 +24,8 @@
page in certain locales
* Fix blocklist not recognising comments that begin with whitespace
* Minor speedup in parsing blocklists
+ * Blocklist now attempts to download the URL multiple times before
giving
+ up
=== Deluge 1.2.0_rc5 (17 December 2009) ===
==== Web ====
Modified: branches/1.2_RC/deluge/plugins/blocklist/blocklist/core.py
===================================================================
--- branches/1.2_RC/deluge/plugins/blocklist/blocklist/core.py 2010-01-03
01:37:57 UTC (rev 6074)
+++ branches/1.2_RC/deluge/plugins/blocklist/blocklist/core.py 2010-01-03
16:27:05 UTC (rev 6075)
@@ -246,7 +246,6 @@
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:
@@ -258,13 +257,13 @@
bl_filename = "blocklist.cache" if self.use_cache else
"blocklist.download"
d = threads.deferToThread(self.update_info,
deluge.configmanager.get_config_dir(bl_filename))
- 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, force=False):
@@ -331,8 +330,7 @@
try_again = True
elif os.path.exists(blocklist) and not self.use_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())
self.use_cache = True
try_again = True
Modified: trunk/deluge/plugins/blocklist/blocklist/core.py
===================================================================
--- trunk/deluge/plugins/blocklist/blocklist/core.py 2010-01-03 01:37:57 UTC
(rev 6074)
+++ trunk/deluge/plugins/blocklist/blocklist/core.py 2010-01-03 16:27:05 UTC
(rev 6075)
@@ -276,7 +276,6 @@
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 @@
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 @@
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
--
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en.