Better logging on file update
This commit is contained in:
parent
8bfef12ad4
commit
50bbe47bf2
1 changed files with 5 additions and 5 deletions
|
@ -122,12 +122,12 @@ class FileRequest(object):
|
|||
should_validate_content = False
|
||||
valid = None # Same or earlier content as we have
|
||||
elif not body: # No body sent, we have to download it first
|
||||
self.log.debug("Missing body from update, downloading...")
|
||||
site.log.debug("Missing body from update for file %s, downloading ..." % inner_path)
|
||||
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True, source="update") # Add or get peer
|
||||
try:
|
||||
body = peer.getFile(site.address, inner_path).read()
|
||||
except Exception as err:
|
||||
self.log.debug("Can't download updated file %s: %s" % (inner_path, err))
|
||||
site.log.debug("Can't download updated file %s: %s" % (inner_path, err))
|
||||
self.response({"error": "File invalid update: Can't download updaed file"})
|
||||
self.connection.badAction(5)
|
||||
return
|
||||
|
@ -136,7 +136,7 @@ class FileRequest(object):
|
|||
try:
|
||||
content = json.loads(body.decode())
|
||||
except Exception as err:
|
||||
self.log.debug("Update for %s is invalid JSON: %s" % (inner_path, err))
|
||||
site.log.debug("Update for %s is invalid JSON: %s" % (inner_path, err))
|
||||
self.response({"error": "File invalid JSON"})
|
||||
self.connection.badAction(5)
|
||||
return
|
||||
|
@ -149,7 +149,7 @@ class FileRequest(object):
|
|||
try:
|
||||
valid = site.content_manager.verifyFile(inner_path, content)
|
||||
except Exception as err:
|
||||
self.log.debug("Update for %s is invalid: %s" % (inner_path, err))
|
||||
site.log.debug("Update for %s is invalid: %s" % (inner_path, err))
|
||||
error = err
|
||||
valid = False
|
||||
|
||||
|
@ -187,7 +187,7 @@ class FileRequest(object):
|
|||
if inner_path in site.content_manager.contents:
|
||||
peer.last_content_json_update = site.content_manager.contents[inner_path]["modified"]
|
||||
if config.verbose:
|
||||
self.log.debug(
|
||||
site.log.debug(
|
||||
"Same version, adding new peer for locked files: %s, tasks: %s" %
|
||||
(peer.key, len(site.worker_manager.tasks))
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue