From e02fadcef0351c368c4d51d39a8adbb9c1d41d4c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 20 Oct 2019 10:53:25 +0100 Subject: [PATCH] Don't use loop --- posts.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/posts.py b/posts.py index f79f74cd0..c763920e0 100644 --- a/posts.py +++ b/posts.py @@ -1928,19 +1928,11 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \ sharedInboxFilename=os.path.join(sharedBoxDir, postFilename) # get the actor from the shared post - loadedPost=False - tries=0 - while tries<5: - try: - with open(sharedInboxFilename, 'r') as fp: - postJsonObject=commentjson.load(fp) - loadedPost=True - break - except Exception as e: - print('WARN: commentjson exception createBoxBase - '+str(e)) - time.sleep(1) - tries+=1 - if not loadedPost: + try: + with open(sharedInboxFilename, 'r') as fp: + postJsonObject=commentjson.load(fp) + except Exception as e: + print('WARN: commentjson exception createBoxBase - '+str(e)) continue actorNickname=getNicknameFromActor(postJsonObject['actor'])