Skip to content
Snippets Groups Projects
Commit a641674d authored by Sebastian Gehaxelt's avatar Sebastian Gehaxelt
Browse files

Handle irc reconnects better by not starting fetcher threads again

parent 8ae4ede2
No related branches found
No related tags found
No related merge requests found
...@@ -138,6 +138,7 @@ class Bot(object): ...@@ -138,6 +138,7 @@ class Bot(object):
self.__config = Config() self.__config = Config()
self.__irc = IRCBot(self.__config, self.__db, self.on_started) self.__irc = IRCBot(self.__config, self.__db, self.on_started)
self.__threads = [] self.__threads = []
self.__connected = False
def start(self): def start(self):
"""Starts the IRC bot""" """Starts the IRC bot"""
...@@ -145,6 +146,7 @@ class Bot(object): ...@@ -145,6 +146,7 @@ class Bot(object):
def on_started(self): def on_started(self):
"""Gets executed after the IRC thread has successfully established a connection.""" """Gets executed after the IRC thread has successfully established a connection."""
if not self.__connected:
print "Connected!" print "Connected!"
# Start one fetcher thread per feed # Start one fetcher thread per feed
...@@ -153,6 +155,7 @@ class Bot(object): ...@@ -153,6 +155,7 @@ class Bot(object):
t.start() t.start()
self.__threads.append(t) self.__threads.append(t)
print "Started fetcher threads!" print "Started fetcher threads!"
self.__connected = True
def __fetch_feed(self, feed_info): def __fetch_feed(self, feed_info):
"""Fetches a RSS feed, parses it and updates the database and/or announces new news.""" """Fetches a RSS feed, parses it and updates the database and/or announces new news."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment