Rev2025, Publish remotely outdated files on modification check
This commit is contained in:
parent
e1f7752aff
commit
03f3e9e4fd
2 changed files with 11 additions and 6 deletions
|
@ -10,7 +10,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.5.3"
|
||||
self.rev = 2023
|
||||
self.rev = 2025
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.config_file = "zeronet.conf"
|
||||
|
|
|
@ -303,11 +303,16 @@ class Site(object):
|
|||
modified_contents = []
|
||||
my_modified = self.content_manager.listModified(since)
|
||||
for inner_path, modified in res["modified_files"].iteritems(): # Check if the peer has newer files than we
|
||||
newer = int(modified) > my_modified.get(inner_path, 0)
|
||||
if newer and inner_path not in self.bad_files and not self.content_manager.isArchived(inner_path, modified):
|
||||
# We dont have this file or we have older
|
||||
modified_contents.append(inner_path)
|
||||
self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1
|
||||
has_newer = int(modified) > my_modified.get(inner_path, 0)
|
||||
has_older = int(modified) < my_modified.get(inner_path, 0)
|
||||
if inner_path not in self.bad_files and not self.content_manager.isArchived(inner_path, modified):
|
||||
if has_newer:
|
||||
# We dont have this file or we have older
|
||||
modified_contents.append(inner_path)
|
||||
self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1
|
||||
if has_older:
|
||||
self.log.debug("%s client has older version of %s, publishing there..." % (peer, inner_path))
|
||||
gevent.spawn(self.publisher, inner_path, [peer], [], 1)
|
||||
if modified_contents:
|
||||
self.log.debug("%s new modified file from %s" % (len(modified_contents), peer))
|
||||
modified_contents.sort(key=lambda inner_path: 0 - res["modified_files"][inner_path]) # Download newest first
|
||||
|
|
Loading…
Reference in a new issue