Don't use loop

main2
Bob Mottram 2019-10-20 10:53:25 +01:00
parent 71f2b04bfc
commit e02fadcef0
1 changed files with 5 additions and 13 deletions

View File

@ -1928,19 +1928,11 @@ def createSharedInboxIndex(baseDir: str,sharedBoxDir: str, \
sharedInboxFilename=os.path.join(sharedBoxDir, postFilename) sharedInboxFilename=os.path.join(sharedBoxDir, postFilename)
# get the actor from the shared post # get the actor from the shared post
loadedPost=False try:
tries=0 with open(sharedInboxFilename, 'r') as fp:
while tries<5: postJsonObject=commentjson.load(fp)
try: except Exception as e:
with open(sharedInboxFilename, 'r') as fp: print('WARN: commentjson exception createBoxBase - '+str(e))
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:
continue continue
actorNickname=getNicknameFromActor(postJsonObject['actor']) actorNickname=getNicknameFromActor(postJsonObject['actor'])