From 9b85d8638d30205c72ca8c8c162bcd01022f5405 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Thu, 20 Feb 2020 17:25:56 +0100 Subject: [PATCH] Don't allow run site api calls when site is deleting --- src/Site/Site.py | 1 + src/Ui/UiWebsocket.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/Site/Site.py b/src/Site/Site.py index 09ff03c9d..32f10abed 100644 --- a/src/Site/Site.py +++ b/src/Site/Site.py @@ -1059,6 +1059,7 @@ def delete(self): self.log.info("Deleting site...") s = time.time() self.settings["serving"] = False + self.settings["deleting"] = True self.saveSettings() num_greenlets = self.greenlet_manager.stopGreenlets("Site %s deleted" % self.address) self.worker_manager.running = False diff --git a/src/Ui/UiWebsocket.py b/src/Ui/UiWebsocket.py index e48196446..7fce398bd 100644 --- a/src/Ui/UiWebsocket.py +++ b/src/Ui/UiWebsocket.py @@ -216,6 +216,9 @@ def handleRequest(self, req): else: # Normal command func_name = self.getCmdFuncName(cmd) func = getattr(self, func_name, None) + if self.site.settings.get("deleting"): + return self.response(req["id"], {"error": "Site is deleting"}) + if not func: # Unknown command return self.response(req["id"], {"error": "Unknown command: %s" % cmd})