From 2722607f9c7b59f6bbf732f6a20f8dc0be17a2d0 Mon Sep 17 00:00:00 2001 From: myumyu <23904-myumyu@users.noreply.gitgud.io> Date: Tue, 19 Oct 2021 21:28:54 +0100 Subject: [PATCH] Fixed bug (duplicate notification on reconnect) --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index da5f43c..b796ec8 100755 --- a/main.py +++ b/main.py @@ -42,14 +42,15 @@ def watch_live_posts(evaluate, notify): try: client.connect(f'wss://{config.IB_DOMAIN_NAME}/', headers={'Cookie': get_auth_cookie()}) client.emit('room', 'globalmanage-recent-hashed') + notify(f'Connected', f'Watching live posts') + client.wait() # blocks the thread until something happens except Exception as e: logging.error(f'Exception in live posts watcher: {e}') notify(f'Lost live posts connection', f'Retrying in {config.LIVE_POSTS_RETRY_TIMEOUT} seconds') time.sleep(config.LIVE_POSTS_RETRY_TIMEOUT) # waits for a bit, maybe will fix itself - notify(f'Connected', f'Watching live posts') - client.wait() # blocks the thread until something happens + def watch_reports(notify):