From 0e9bb519859c23bf9c8b641f1b1e0bc5d617e565 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 3 Nov 2020 16:08:31 +0000 Subject: [PATCH] Re-establish session for newswire if needed --- newsdaemon.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/newsdaemon.py b/newsdaemon.py index a6e4fc0b..ccfa86c7 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -31,6 +31,7 @@ from utils import saveJson from utils import getStatusNumber from utils import clearFromPostCaches from inbox import storeHashTags +from session import createSession def updateFeedsOutboxIndex(baseDir: str, domain: str, postId: str) -> None: @@ -694,9 +695,14 @@ def runNewswireDaemon(baseDir: str, httpd, while True: # has the session been created yet? if not httpd.session: - print('Newswire daemon waiting for session') - time.sleep(60) - continue + print('Newswire daemon has no session') + httpd.session = createSession(httpd.proxyType) + if not httpd.session: + print('Newswire daemon waiting for session') + time.sleep(60) + continue + else: + print('Newswire daemon session established') # try to update the feeds newNewswire = None