More error handling for session creation

main
Bob Mottram 2020-06-08 21:22:18 +01:00
parent 99a4b65467
commit 8ed646aed5
2 changed files with 6 additions and 2 deletions

View File

@ -214,8 +214,10 @@ def postMessageToOutbox(messageJson: {}, postToNickname: str,
if not server.session:
if debug:
print('DEBUG: creating new session for c2s')
server.session = \
createSession(useTor)
server.session = createSession(useTor)
if not server.session:
print('ERROR: Failed to create session for postMessageToOutbox')
return False
if debug:
print('DEBUG: sending c2s post to followers')
# remove inactive threads

View File

@ -2831,6 +2831,8 @@ def getPublicPostsOfPerson(baseDir: str, nickname: str, domain: str,
""" This is really just for test purposes
"""
session = createSession(useTor)
if not session:
return
personCache = {}
cachedWebfingers = {}
federationList = []