Check that post was saved

main2
Bob Mottram 2019-10-19 14:00:46 +01:00
parent b19ab510bd
commit 192236d58e
1 changed files with 13 additions and 11 deletions

View File

@ -1623,29 +1623,31 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJsonObject,debug) obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJsonObject,debug)
# save the post to file # save the post to file
postSavedToFile=False
tries=0 tries=0
while tries<5: while tries<5:
try: try:
with open(destinationFilename, 'w+') as fp: with open(destinationFilename, 'w+') as fp:
commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False) commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False)
postSavedToFile=True
break break
except Exception as e: except Exception as e:
print(e) print(e)
time.sleep(1) time.sleep(1)
tries+=1 tries+=1
inboxUpdateCalendar(baseDir,handle,postJsonObject) if postSavedToFile:
inboxUpdateCalendar(baseDir,handle,postJsonObject)
inboxStorePostToHtmlCache(translate,baseDir,httpPrefix, \
session,cachedWebfingers,personCache, \
handle.split('@')[0],domain,port, \
postJsonObject,allowDeletion)
inboxStorePostToHtmlCache(translate,baseDir,httpPrefix, \ # send the post out to group members
session,cachedWebfingers,personCache, \ if isGroup:
handle.split('@')[0],domain,port, \ sendToGroupMembers(session,baseDir,handle,port,postJsonObject, \
postJsonObject,allowDeletion) httpPrefix,federationList,sendThreads, \
postLog,cachedWebfingers,personCache,debug)
# send the post out to group members
if isGroup:
sendToGroupMembers(session,baseDir,handle,port,postJsonObject, \
httpPrefix,federationList,sendThreads, \
postLog,cachedWebfingers,personCache,debug)
# if the post wasn't saved # if the post wasn't saved
if not os.path.isfile(destinationFilename): if not os.path.isfile(destinationFilename):