Less verbose logging
This commit is contained in:
parent
258822d74b
commit
5a34448ba1
4 changed files with 15 additions and 6 deletions
|
@ -627,6 +627,7 @@ class ContentManager(object):
|
|||
valid_signs += CryptBitcoin.verify(sign_content, address, signs[address])
|
||||
if valid_signs >= signs_required:
|
||||
break # Break if we has enough signs
|
||||
if config.verbose:
|
||||
self.log.debug("%s: Valid signs: %s/%s" % (inner_path, valid_signs, signs_required))
|
||||
return valid_signs >= signs_required
|
||||
else: # Old style signing
|
||||
|
|
|
@ -222,13 +222,16 @@ class Site(object):
|
|||
continue # Failed query
|
||||
|
||||
queried.append(peer)
|
||||
num_modified = 0
|
||||
for inner_path, modified in res["modified_files"].iteritems(): # Check if the peer has newer files than we
|
||||
content = self.content_manager.contents.get(inner_path)
|
||||
if (not content or modified > content["modified"]) and inner_path not in self.bad_files:
|
||||
self.log.debug("New modified file from %s: %s" % (peer, inner_path))
|
||||
num_modified += 1
|
||||
# We dont have this file or we have older
|
||||
self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1 # Mark as bad file
|
||||
gevent.spawn(self.downloadContent, inner_path) # Download the content.json + the changed files
|
||||
if num_modified > 0:
|
||||
self.log.debug("%s new modified file from %s" % (num_modified, peer))
|
||||
|
||||
# Check modified content.json files from peers and add modified files to bad_files
|
||||
# Return: Successfully queried peers [Peer, Peer...]
|
||||
|
@ -889,6 +892,7 @@ class Site(object):
|
|||
def fileDone(self, inner_path):
|
||||
# File downloaded, remove it from bad files
|
||||
if inner_path in self.bad_files:
|
||||
if config.verbose:
|
||||
self.log.debug("Bad file solved: %s" % inner_path)
|
||||
del(self.bad_files[inner_path])
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ class SiteStorage:
|
|||
self.closeDb()
|
||||
self.openDb()
|
||||
elif not config.disable_db and inner_path.endswith(".json") and self.has_db: # Load json file to db
|
||||
if config.verbose:
|
||||
self.log.debug("Loading json file to db: %s" % inner_path)
|
||||
try:
|
||||
self.getDb().loadJson(file_path)
|
||||
|
|
|
@ -3,6 +3,7 @@ import time
|
|||
import gevent
|
||||
|
||||
from Debug import Debug
|
||||
from Config import config
|
||||
|
||||
|
||||
class Worker(object):
|
||||
|
@ -34,8 +35,10 @@ class Worker(object):
|
|||
task["time_started"] = time.time() # Task started now
|
||||
|
||||
if task["workers_num"] > 0: # Wait a bit if someone already working on it
|
||||
if config.verbose:
|
||||
self.manager.log.debug("%s: Someone already working on %s, sleeping 1 sec..." % (self.key, task["inner_path"]))
|
||||
time.sleep(1)
|
||||
if config.verbose:
|
||||
self.manager.log.debug("%s: %s, task done after sleep: %s" % (self.key, task["inner_path"], task["done"]))
|
||||
|
||||
if task["done"] is False:
|
||||
|
|
Loading…
Reference in a new issue