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)
# 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'])