mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Fixed duplicated streams. Removed unneeded code for connection checkers
This commit is contained in:
parent
a053788cce
commit
105debe4da
@ -1247,17 +1247,15 @@ class Controller(object):
|
|||||||
def manage_stream_errors(self, session):
|
def manage_stream_errors(self, session):
|
||||||
log.error(" Restarting %s session streams. It will be destroyed" % (session,))
|
log.error(" Restarting %s session streams. It will be destroyed" % (session,))
|
||||||
s = session_.sessions[session]
|
s = session_.sessions[session]
|
||||||
try:
|
if hasattr(s, "main_stream"):
|
||||||
if hasattr(s, "main_stream"):
|
s.main_stream.disconnect()
|
||||||
self.main_stream.disconnect()
|
log.error("main stream disconnected")
|
||||||
log.error("main stream disconnected")
|
del s.main_stream
|
||||||
del s.main_stream
|
if hasattr(s, "timelinesStream"):
|
||||||
self.timelinesStream.disconnect()
|
s.timelinesStream.disconnect()
|
||||||
del s.timelinesStream
|
del s.timelinesStream
|
||||||
s.counter = 0
|
s.counter = 0
|
||||||
s.reconnection_function_active = False
|
s.reconnection_function_active = False
|
||||||
except AttributeError:
|
|
||||||
log.error("Error deleting some thing")
|
|
||||||
# for i in self.buffers:
|
# for i in self.buffers:
|
||||||
# if i.invisible == True and i.session.session_id == s.session_id and i.type != "people":
|
# if i.invisible == True and i.session.session_id == s.session_id and i.type != "people":
|
||||||
# i.start_stream()
|
# i.start_stream()
|
||||||
|
@ -304,8 +304,10 @@ class Session(object):
|
|||||||
def start_streaming(self):
|
def start_streaming(self):
|
||||||
|
|
||||||
""" Start the streaming for sending tweets in realtime."""
|
""" Start the streaming for sending tweets in realtime."""
|
||||||
self.get_timelines()
|
if not hasattr(self, "main_stream"):
|
||||||
self.get_main_stream()
|
self.get_timelines()
|
||||||
|
if not hasattr(self, "timelinesStream"):
|
||||||
|
self.get_main_stream()
|
||||||
|
|
||||||
def get_main_stream(self):
|
def get_main_stream(self):
|
||||||
log.debug("Starting the main stream...")
|
log.debug("Starting the main stream...")
|
||||||
@ -360,10 +362,10 @@ class Session(object):
|
|||||||
self.reconnection_function_active = False
|
self.reconnection_function_active = False
|
||||||
if hasattr(self, "timelinesStream") and not hasattr(self.timelinesStream, "friends"):
|
if hasattr(self, "timelinesStream") and not hasattr(self.timelinesStream, "friends"):
|
||||||
self.add_friends()
|
self.add_friends()
|
||||||
try:
|
# try:
|
||||||
urllib2.urlopen("http://74.125.228.231", timeout=5)
|
# urllib2.urlopen("http://74.125.228.231", timeout=5)
|
||||||
except urllib2.URLError:
|
# except urllib2.URLError:
|
||||||
pub.sendMessage("stream-error", session=self.session_id)
|
# pub.sendMessage("stream-error", session=self.session_id)
|
||||||
|
|
||||||
def remove_stream(self, stream):
|
def remove_stream(self, stream):
|
||||||
if stream == "timelinesStream":
|
if stream == "timelinesStream":
|
||||||
|
Loading…
Reference in New Issue
Block a user