From d55be4d497b0236ae79e15ea73f5d8b3124e3408 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 31 Aug 2019 14:08:01 +0100 Subject: [PATCH] Exception handling if busy --- daemon.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index fdb745032..08627e84c 100644 --- a/daemon.py +++ b/daemon.py @@ -1348,8 +1348,19 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix+':##'+self.server.domainFull+'#users#'+nickname+'#statuses#'+statusNumber+'.json' if os.path.isfile(postFilename): postJsonObject={} - with open(postFilename, 'r') as fp: - postJsonObject=commentjson.load(fp) + readPost=False + try: + with open(postFilename, 'r') as fp: + postJsonObject=commentjson.load(fp) + readPost=True + except Exception as e: + print(e) + if not readPost: + self.send_response(429) + self.end_headers() + self.server.GETbusy=False + return + else: # Only authorized viewers get to see likes on posts # Otherwize marketers could gain more social graph info if not authorized: