Doubled Site Publish Limits

This commit is contained in:
canewsin 2021-12-22 14:05:01 +05:30
parent 18da16e8d4
commit 7575e2d455
6 changed files with 7 additions and 6 deletions

View file

@ -165,7 +165,7 @@ class FileRequest(object):
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True, source="update") # Add or get peer
# On complete publish to other peers
diffs = params.get("diffs", {})
site.onComplete.once(lambda: site.publish(inner_path=inner_path, diffs=diffs, limit=3), "publish_%s" % inner_path)
site.onComplete.once(lambda: site.publish(inner_path=inner_path, diffs=diffs, limit=6), "publish_%s" % inner_path)
# Load new content file and download changed files in new thread
def downloader():

View file

@ -59,6 +59,7 @@ class UiServer:
self.ip = "0.0.0.0" # Bind all
if config.ui_host:
self.allowed_hosts = set(config.ui_host)
#TODO: For proxies allow sub domains(www) as valid hosts, should be user preference.
elif config.ui_ip == "127.0.0.1":
# IP Addresses are inherently allowed as they are immune to DNS
# rebinding attacks.

View file

@ -510,7 +510,7 @@ class UiWebsocket(object):
progress
])
diffs = site.content_manager.getDiffs(inner_path)
back = site.publish(limit=5, inner_path=inner_path, diffs=diffs, cb_progress=cbProgress)
back = site.publish(limit=10, inner_path=inner_path, diffs=diffs, cb_progress=cbProgress)
if back == 0: # Failed to publish to anyone
self.cmd("progress", ["publish", _["Content publish failed."], -100])
else:

View file

@ -432,7 +432,7 @@ class Actions(object):
else: # Just ask the tracker
logging.info("Gathering peers from tracker")
site.announce() # Gather peers
published = site.publish(5, inner_path) # Push to peers
published = site.publish(10, inner_path) # Push to peers
if published > 0:
time.sleep(3)
logging.info("Serving files (max 60s)...")