From 8ed646aed5efb6efafd66c546575bf02d6390c93 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 8 Jun 2020 21:22:18 +0100 Subject: [PATCH] More error handling for session creation --- outbox.py | 6 ++++-- posts.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/outbox.py b/outbox.py index c998d1a1..2e08fa09 100644 --- a/outbox.py +++ b/outbox.py @@ -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 diff --git a/posts.py b/posts.py index 94798aab..2f9b75c5 100644 --- a/posts.py +++ b/posts.py @@ -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 = []