bot, irc, coretasks: more robust bot.connection_registered value
#2375
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The
connection_registeredattribute itself is now a property, which first checks to see if the bot'sbackendexists (is notNone) and then whether thebackend.is_connected(), before finally seeing if the internal_connection_registeredflag has been set.Also added a few places where the internal flag should be reset back to its initial value of
False, such as if the bot is about to quit or the backend'son_close()handler was called.All of this is to try and make
bot.connection_registeredreliable for plugins likeremind, which have scheduled tasks that might need to send data to IRC and need a reliable way to check whether the connection is ready to accept such data before operating.Checklist
make qa(runsmake qualityandmake test)test_coretasksunits.