Rev2059, Fix download test, boost priority on request by 15, Adjust default priorities

This commit is contained in:
shortcutme 2017-05-07 21:21:26 +02:00
parent db744f576e
commit f67cb7b145
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
4 changed files with 9 additions and 9 deletions

View file

@ -10,7 +10,7 @@ class Config(object):
def __init__(self, argv): def __init__(self, argv):
self.version = "0.5.4" self.version = "0.5.4"
self.rev = 2058 self.rev = 2059
self.argv = argv self.argv = argv
self.action = None self.action = None
self.config_file = "zeronet.conf" self.config_file = "zeronet.conf"

View file

@ -35,8 +35,8 @@ class TestSiteDownload:
def boostRequest(inner_path): def boostRequest(inner_path):
# I really want these file # I really want these file
if inner_path == "index.html": if inner_path == "index.html":
site_temp.needFile("data/img/multiuser.png", priority=5, blocking=False) site_temp.needFile("data/img/multiuser.png", priority=15, blocking=False)
site_temp.needFile("data/img/direct_domains.png", priority=5, blocking=False) site_temp.needFile("data/img/direct_domains.png", priority=15, blocking=False)
site_temp.onFileDone.append(boostRequest) site_temp.onFileDone.append(boostRequest)
site_temp.download(blind_includes=True).join(timeout=5) site_temp.download(blind_includes=True).join(timeout=5)
file_requests = [request[2]["inner_path"] for request in requests if request[0] in ("getFile", "streamFile")] file_requests = [request[2]["inner_path"] for request in requests if request[0] in ("getFile", "streamFile")]

View file

@ -389,7 +389,7 @@ class UiRequest(object):
if path_parts["inner_path"].endswith("favicon.ico"): # Default favicon for all sites if path_parts["inner_path"].endswith("favicon.ico"): # Default favicon for all sites
return self.actionFile("src/Ui/media/img/favicon.ico") return self.actionFile("src/Ui/media/img/favicon.ico")
result = site.needFile(path_parts["inner_path"], priority=5) # Wait until file downloads result = site.needFile(path_parts["inner_path"], priority=15) # Wait until file downloads
if result: if result:
return self.actionFile(file_path, header_length=header_length) return self.actionFile(file_path, header_length=header_length)
else: else:

View file

@ -391,16 +391,16 @@ class WorkerManager(object):
if "-default" in inner_path: if "-default" in inner_path:
return -4 # Default files are cloning not important return -4 # Default files are cloning not important
elif inner_path.endswith(".css"): elif inner_path.endswith(".css"):
return 17 # boost css files priority return 13 # boost css files priority
elif inner_path.endswith(".js"): elif inner_path.endswith(".js"):
return 16 # boost js files priority return 12 # boost js files priority
elif inner_path.endswith("dbschema.json"): elif inner_path.endswith("dbschema.json"):
return 15 # boost database specification return 11 # boost database specification
elif inner_path.endswith("content.json"): elif inner_path.endswith("content.json"):
return 1 # boost included content.json files priority a bit return 1 # boost included content.json files priority a bit
elif inner_path.endswith(".json"): elif inner_path.endswith(".json"):
if len(inner_path) < 50: # Boost non-user json files more if len(inner_path) < 50: # Boost non-user json files
return 14 return 10
else: else:
return 2 return 2
return 0 return 0