Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-rss2irc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jérôme Charaoui
python-rss2irc
Commits
a641674d
Commit
a641674d
authored
May 15, 2016
by
Sebastian Gehaxelt
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bot.py
+11
-8
11 additions, 8 deletions
bot.py
with
11 additions
and
8 deletions
bot.py
+
11
−
8
View file @
a641674d
...
@@ -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.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment