need_new_blocklist now checks if remote blockist is newer/bigger
This commit is contained in:
parent
58361f4af2
commit
813063bd12
|
@ -258,7 +258,19 @@ class Core(CorePluginBase):
|
||||||
if list_size == 0:
|
if list_size == 0:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if current_time >= (list_time + datetime.timedelta(days=self.config["check_after_days"])):
|
import socket
|
||||||
|
socket.setdefaulttimeout(self.config["timeout"])
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Get remote blocklist time stamp and size
|
||||||
|
remote_stats = urllib.urlopen(self.config["url"]).info()
|
||||||
|
remote_size = remote_stats["content-length"]
|
||||||
|
remote_time = datetime.datetime.strptime(remote_stats["last-modified"],"%a, %d %b %Y %H:%M:%S GMT")
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("Unable to get blocklist stats: %s", e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if list_time < remote_time or list_size < remote_size:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue