Skip to content

Commit

Permalink
Don't allow run site api calls when site is deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Feb 20, 2020
1 parent a9c75a3 commit 9b85d86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Site/Site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/Ui/UiWebsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down

0 comments on commit 9b85d86

Please sign in to comment.