diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 0dc5e29d..340f6071 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -655,17 +655,20 @@ class Controller(object): log.debug("Saving global configuration...") for item in sessions.sessions: if sessions.sessions[item].logged == False: continue + log.debug("Disconnecting streaming endpoint for session" + sessions.sessions[item].session_id) + sessions.sessions[item].stop_streaming() log.debug("Disconnecting streams for %s session" % (sessions.sessions[item].session_id,)) sessions.sessions[item].sound.cleaner.cancel() log.debug("Saving database for " + sessions.sessions[item].session_id) sessions.sessions[item].save_persistent_data() - log.debug("Disconnecting streaming endpoint for session" + sessions.sessions[item].session_id) - sessions.sessions[item].stop_streaming() if system == "Windows": self.systrayIcon.RemoveIcon() pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name)) if os.path.exists(pidpath): os.remove(pidpath) + if hasattr(self, "streams_checker_function"): + log.debug("Stopping stream checker...") + self.streams_checker_function.cancel() widgetUtils.exit_application() def follow(self, *args, **kwargs): diff --git a/src/sessions/twitter/session.py b/src/sessions/twitter/session.py index 6e01a9e8..cdfd9684 100644 --- a/src/sessions/twitter/session.py +++ b/src/sessions/twitter/session.py @@ -510,9 +510,8 @@ class Session(base.baseSession): self.stream_thread = call_threaded(self.stream.filter, follow=self.stream_listener.users, stall_warnings=True) def stop_streaming(self): - if hasattr(self, "stream_thread"): - self.stream_thread.join() - log.debug("Stopping Streaming Endpoint...") + self.stream.running = False + log.debug("Stream stopped for accounr {}".format(self.db["user_name"])) def handle_new_status(self, status, user): """ Handles a new status present in the Streaming API. """