Try and catch block for dbRebuild (#2047)

* Try and catch block for dbRebuild

* Use self.log.error and not logging

* Use self.log.error and not logging in SiteStorage also

* Check if the rebuild is working
This commit is contained in:
Lola Dam 2019-06-23 14:21:50 +02:00 committed by ZeroNet
parent 9a267ffcaf
commit 753396ac0c
8 changed files with 55 additions and 23 deletions

View file

@ -786,9 +786,10 @@ class UiWebsocketPlugin(object):
if "ADMIN" not in permissions:
return self.response(to, "You don't have permission to run this command")
result = self.site.storage.rebuildDb()
try:
self.site.storage.rebuildDb()
except Exception as err:
return self.response(to, {"error": str(err)})
if not result:
return self.response(to, {"error": "Failed to rebuild database"})
return self.response(to, "ok")

View file

@ -814,6 +814,7 @@ window.initScrollable = function () {
this.tag.find("#button-dbrebuild").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.wrapper.notifications.add("done-dbrebuild", "info", "Database rebuilding....");
_this.wrapper.ws.cmd("dbRebuild", [], function(response) {
if (response !== "ok") {