Rev597, Dont load content.json if the modified date is same, Big content.json memory optimalzations, Peerhashfield memory optimalzations and typo fix, Give up on file after 10 retry, Fix non-ascii install paths, Stop worker after 10 connection error

This commit is contained in:
HelloZeroNet 2015-11-15 11:13:57 +01:00
parent 7f05e96f05
commit 3d558a4edf
6 changed files with 26 additions and 9 deletions

View file

@ -485,8 +485,14 @@ class Site:
self.log.debug("No info for %s, waiting for all content.json" % inner_path)
success = self.downloadContent("content.json", download_files=False)
if not success:
if self.bad_files.get(inner_path, 0) > 10:
del self.bad_files[inner_path]
self.log.debug("Max retry reached, giving up on %s" % inner_path)
return False
if not self.content_manager.getFileInfo(inner_path):
if self.bad_files.get(inner_path, 0) > 10:
del self.bad_files[inner_path]
self.log.debug("Max retry reached, giving up on %s" % inner_path)
return False # Still no info for file
task = self.worker_manager.addTask(inner_path, peer, priority=priority)

View file

@ -3,6 +3,7 @@ import re
import shutil
import json
import time
import sys
import sqlite3
import gevent.event
@ -18,7 +19,7 @@ class SiteStorage:
def __init__(self, site, allow_create=True):
self.site = site
self.directory = "%s/%s" % (config.data_dir, self.site.address) # Site data diretory
self.allowed_dir = os.path.abspath(self.directory) # Only serve/modify file within this dir
self.allowed_dir = os.path.abspath(self.directory.decode(sys.getfilesystemencoding())) # Only serve/modify file within this dir
self.log = site.log
self.db = None # Db class
self.db_checked = False # Checked db tables since startup