From c4a06a7bc0627a315b061392cd77c4ba95c956e7 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 25 May 2017 11:52:29 +0400 Subject: [PATCH] Improved check_connection for avoiding a rece condition. Fixes #136 --- doc/changelog.md | 1 + src/controller/mainController.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index 5cd36f0e..c97642a1 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -9,6 +9,7 @@ * SndUp users will be able to upload audio in their account by using their API Key again. ([#134](https://github.com/manuelcortez/TWBlue/issues/134)) * old tweets shouldn't be added as new items in buffers. ([#116,](https://github.com/manuelcortez/TWBlue/issues/116)) ([#133](https://github.com/manuelcortez/TWBlue/issues/133)) * All mentionned users should be displayed correctly in Twishort's long tweets. ([#116,](https://github.com/manuelcortez/TWBlue/issues/116)) ([#135](https://github.com/manuelcortez/TWBlue/issues/135)) +* And more ([#136,](https://github.com/manuelcortez/TWBlue/issues/136)) ## Changes in version 0.90 diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 4135048b..b208677d 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -217,6 +217,7 @@ class Controller(object): self.view = view.mainFrame() # buffers list. self.buffers = [] + self.started = False # accounts list. self.accounts = [] # This saves the current account (important in invisible mode) @@ -265,6 +266,7 @@ class Controller(object): session_.sessions[session_.sessions.keys()[0]].sound.play("ready.ogg") if config.app["app-settings"]["speak_ready_msg"] == True: output.speak(_(u"Ready")) + self.started = True def create_ignored_session_buffer(self, session): self.accounts.append(session.settings["twitter"]["user_name"]) @@ -1376,9 +1378,14 @@ class Controller(object): # s.listen_stream_error() def check_connection(self): + if self.started == False: + return for i in session_.sessions: - if session_.sessions[i].is_logged == False: continue - session_.sessions[i].check_connection() + try: + if session_.sessions[i].is_logged == False: continue + session_.sessions[i].check_connection() + except TwythonError: # We shouldn't allow this function to die. + pass def create_new_buffer(self, buffer, account, create): buff = self.search_buffer("home_timeline", account)