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
|
should_validate_content = False
|
||||||
valid = None # Same or earlier content as we have
|
valid = None # Same or earlier content as we have
|
||||||
elif not body: # No body sent, we have to download it first
|
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
|
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True, source="update") # Add or get peer
|
||||||
try:
|
try:
|
||||||
body = peer.getFile(site.address, inner_path).read()
|
body = peer.getFile(site.address, inner_path).read()
|
||||||
except Exception as err:
|
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.response({"error": "File invalid update: Can't download updaed file"})
|
||||||
self.connection.badAction(5)
|
self.connection.badAction(5)
|
||||||
return
|
return
|
||||||
|
@ -136,7 +136,7 @@ class FileRequest(object):
|
||||||
try:
|
try:
|
||||||
content = json.loads(body.decode())
|
content = json.loads(body.decode())
|
||||||
except Exception as err:
|
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.response({"error": "File invalid JSON"})
|
||||||
self.connection.badAction(5)
|
self.connection.badAction(5)
|
||||||
return
|
return
|
||||||
|
@ -149,7 +149,7 @@ class FileRequest(object):
|
||||||
try:
|
try:
|
||||||
valid = site.content_manager.verifyFile(inner_path, content)
|
valid = site.content_manager.verifyFile(inner_path, content)
|
||||||
except Exception as err:
|
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
|
error = err
|
||||||
valid = False
|
valid = False
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class FileRequest(object):
|
||||||
if inner_path in site.content_manager.contents:
|
if inner_path in site.content_manager.contents:
|
||||||
peer.last_content_json_update = site.content_manager.contents[inner_path]["modified"]
|
peer.last_content_json_update = site.content_manager.contents[inner_path]["modified"]
|
||||||
if config.verbose:
|
if config.verbose:
|
||||||
self.log.debug(
|
site.log.debug(
|
||||||
"Same version, adding new peer for locked files: %s, tasks: %s" %
|
"Same version, adding new peer for locked files: %s, tasks: %s" %
|
||||||
(peer.key, len(site.worker_manager.tasks))
|
(peer.key, len(site.worker_manager.tasks))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue