From 192236d58e09ecd7075ac720706e8d0cf600108b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 19 Oct 2019 14:00:46 +0100 Subject: [PATCH] Check that post was saved --- inbox.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/inbox.py b/inbox.py index e33390593..d7433ae2e 100644 --- a/inbox.py +++ b/inbox.py @@ -1623,29 +1623,31 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ obtainAvatarForReplyPost(session,baseDir,httpPrefix,domain,personCache,postJsonObject,debug) # save the post to file + postSavedToFile=False tries=0 while tries<5: try: with open(destinationFilename, 'w+') as fp: commentjson.dump(postJsonObject, fp, indent=2, sort_keys=False) + postSavedToFile=True break except Exception as e: print(e) time.sleep(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, \ - session,cachedWebfingers,personCache, \ - handle.split('@')[0],domain,port, \ - postJsonObject,allowDeletion) - - # send the post out to group members - if isGroup: - sendToGroupMembers(session,baseDir,handle,port,postJsonObject, \ - 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 not os.path.isfile(destinationFilename):