-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle "Nick in use" notice in IRC adapter. #113
Conversation
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
==========================================
+ Coverage 43.64% 43.64% +<.01%
==========================================
Files 90 90
Lines 3590 3622 +32
Branches 166 166
==========================================
+ Hits 1567 1581 +14
- Misses 1857 1875 +18
Partials 166 166
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this by configuring my local Yetibot to join IRC using my own username (which is taken). The strange thing is it only re-joins 2 out of the 3 channels that it was supposed to after reconnect. Are you seeing this? Or are you testing it another way?
I'm not totally sure what's going on with this behavior, but the fix was to add (reset! current-channels #{})
to stop
:
(defn stop
"Kill the irc conection"
[{:keys [current-channels conn]}]
(when-let [c @conn] (irc/kill c))
(reset! current-channels #{})
(reset! conn nil))
This makes sense, as it will need to re-join all channels after that reconnect.
Yeah, I also have no clue why that is happening. I was testing only the reconnection part though. I've amended commit with your suggestion. |
@sarg awesome, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, Unable to resolve symbol: current-channels in this context
after latest change.
stop
should be:
(defn stop
"Kill the irc conection"
[{:keys [current-channels conn]}]
(when-let [c @conn] (irc/kill c))
(reset! current-channels #{})
(reset! conn nil))
I've pushed the fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarg thanks!
irclj uses separate thread for connection. Whenever "nick in use" occurs it calls callback and then throws Exception which stops the thread. (https://github.com/Raynes/irclj/blob/f230935cd94dc1c86ffb6677c1b6bb8675d3df94/src/irclj/process.clj#L91)
So in order to recover this siutation I have to stop/start adapter.