-
-
Notifications
You must be signed in to change notification settings - Fork 409
irc: tweak backend interface #1890
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
Conversation
dgw
left a comment
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.
Well, this looks straightforward. Just one log message could use tweaking, but I'm not applying the change myself so @Exirel can choose whether to defend his choice, accept my suggestion, or counter with a third option. 😁
I prefer your version. 👍 |
dgw
left a comment
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.
(just lmk if you're not planning to squash)
Co-authored-by: dgw <[email protected]>
2699ea7 to
b6529b7
Compare
|
@dgw all good. |
|
Not in the style I've been using, not really. It's such a tiny internal change that it'll get lumped in with some other note about refactoring or cleanup. 😁 |
Description
We used
async_chat.connectedattribute directly in the code, which we shouldn't, so I replaced it with a new method, added to the abstract IRC backend interface.Also, after further inspection, async_chat's
closemethod can be used safely, so now we call it first, then we ask the bot to do whatever is needed with itson_closemethod. Since this method expect the connection to be closed already, it shouldn't be a problem.The timeout scheduler doesn't need to be joined, since none of its jobs requires to wait that much. I also modified the bot's interface to have a new method (
irc_send) which will ensure that 1) we don't have any conflict with theasync_chat.sendmethod, and 2) makes sure to be thread-safe - the abstract class doesn't need to care about that, it's not its job.For the record, I've run this version of the bot, with these changes, for more than 36h, and I got 0 problem. I connected to Freenode using a secure connection (ssl on), with an authenticated account. So I feel pretty confident about this.
Checklist
make qa(runsmake qualityandmake test)