Skip to content
Browse files

Try to fix list corruption issue

Sometimes the list was send in a corrupted form.  This
appeared to be the result of overwriting the file as it
was being read by the server.  This commit tries to fix
this by saving to a temporary file and then moving it over
the served file.
  • Loading branch information
ShadowNinja committed Feb 4, 2016
1 parent ea3dbeb commit 58f03d0395b3abae6e7181bf64e980d716f0f55b
Showing with 3 additions and 1 deletion.
  1. +3 −1
@@ -365,7 +365,8 @@ def save(self):
self.maxServers = max(servers, self.maxServers)
self.maxClients = max(clients, self.maxClients)

with open(os.path.join("static", "list.json"), "w") as fd:
list_path = os.path.join(app.root_path, app.static_folder, "list.json")
with open(list_path + "~", "w") as fd:
"total": {"servers": servers, "clients": clients},
"total_max": {"servers": self.maxServers, "clients": self.maxClients},
@@ -374,6 +375,7 @@ def save(self):
indent = "\t" if app.config["DEBUG"] else None
os.rename(list_path + "~", list_path)

def update(self, server):
with self.lock:

0 comments on commit 58f03d0

Please sign in to comment.