mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Switched threads to our own facilities and attempts to improve thread management for streaming endpoints
This commit is contained in:
parent
55b1c7bdae
commit
5f11467f27
@ -659,6 +659,8 @@ class Controller(object):
|
||||
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))
|
||||
|
@ -506,8 +506,13 @@ class Session(base.baseSession):
|
||||
|
||||
def start_streaming(self):
|
||||
self.stream_listener = streaming.StreamListener(twitter_api=self.twitter, user=self.db["user_name"], user_id=self.db["user_id"])
|
||||
self.stream = tweepy.Stream(auth = self.auth, listener=self.stream_listener)
|
||||
self.stream_thread = self.stream.filter(follow=self.stream_listener.users, is_async=True)
|
||||
self.stream = streaming.Stream(auth = self.auth, listener=self.stream_listener, chunk_size=1025)
|
||||
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...")
|
||||
|
||||
def handle_new_status(self, status, user):
|
||||
""" Handles a new status present in the Streaming API. """
|
||||
|
Loading…
Reference in New Issue
Block a user