Some bug fixes#1016
Merged
Merged
Conversation
Moved exception logging when cog is being unloaded and messages is still not consumed from `cog_unload` to `consume_messages` itself in try-except block to avoid case when requesting result too early (before cancel finished).
When user left from guild before bot can add Muted role, then catch this error and log.
Made to resolve problem with Reddit cog that revoking access token raise exception because session is closed. To solve this, I made `Bot.closing_tasks` that bot wait before closing. Moved all extensions and cogs removing to `remove_extension` what is called before closing everything else because need to call `cog_unload`.
MarkKoz
requested changes
Jul 21, 2020
Contributor
MarkKoz
left a comment
There was a problem hiding this comment.
This solution is on the right track. I'm willing to accept it for now but we'll need to eventually also work out a solution for manually reloading cogs, since the tasks only get awaited when the bot closes currently. I'll try to think of something and open another PR down the road.
Contributor
Author
|
I think manually reloading cogs isn't big problem, because bot still runs and tasks too. |
Co-authored-by: Mark <kozlovmark@gmail.com>
MarkKoz
requested changes
Jul 23, 2020
Unloading extensions already remove all cogs that is inside it and this is enough good for this case, because bot still call dpy's internal function later to remove cogs not related with extensions (when exist).
MarkKoz
requested changes
Nov 27, 2020
This was referenced Nov 30, 2020
MarkKoz
approved these changes
Dec 2, 2020
Xithrius
reviewed
Dec 29, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
not consumed from
cog_unloadtoconsume_messagesitself intry-except block to avoid the case when requesting result too early
(before cancel finished). Resolves Task result is accessed too early when unloading watch channel cogs #1008
error and log. Resolves Catch mute failures if member leaves the guild #1006. Also found the issue that when the user is muted and joins and quickly leave, then this fail too (tested in dev server).
exception because session is closed. To solve this, I made
Bot.closing_tasksthat bot wait before closing.Moved all extensions and cogs removing to
remove_extensionwhat iscalled before closing everything else because need to call
cog_unload. Resolves Ensure reddit'srevoke_access_tokencompletes before the aiohttp session closes #1011 Might need more discussion about implemention.closing_tasksto finish it before shutdown. Resolves Ensure tasks finish/cancel before the bot shuts down #1012 .