Skip to content

Some bug fixes#1016

Merged
ks129 merged 34 commits into
python-discord:masterfrom
ks129:bug-fixes
Dec 29, 2020
Merged

Some bug fixes#1016
ks129 merged 34 commits into
python-discord:masterfrom
ks129:bug-fixes

Conversation

@ks129
Copy link
Copy Markdown
Contributor

@ks129 ks129 commented Jun 20, 2020

ks129 added 3 commits June 20, 2020 08:47
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`.
@ks129 ks129 requested a review from a team as a code owner June 20, 2020 18:43
@ks129 ks129 requested review from dementati and scragly and removed request for a team June 20, 2020 18:43
@ghost ghost added the needs 2 approvals label Jun 27, 2020
@MarkKoz MarkKoz added t: bug Something isn't working a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: information Related to information commands: (doc, help, information, reddit, site, tags) a: moderation Related to community moderation functionality: (moderation, defcon, verification) p: 3 - low Low Priority labels Jul 13, 2020
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread bot/cogs/moderation/infractions.py Outdated
Comment thread bot/cogs/watchchannels/watchchannel.py
Comment thread bot/bot.py Outdated
Comment thread bot/bot.py Outdated
Comment thread bot/bot.py Outdated
Comment thread bot/bot.py Outdated
Comment thread bot/bot.py Outdated
@ghost ghost added s: waiting for author Waiting for author to address a review or respond to a comment and removed needs 2 approvals labels Jul 21, 2020
@ks129
Copy link
Copy Markdown
Contributor Author

ks129 commented Jul 22, 2020

I think manually reloading cogs isn't big problem, because bot still runs and tasks too.

@ghost ghost added needs 2 approvals and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Jul 23, 2020
Co-authored-by: Mark <kozlovmark@gmail.com>
Comment thread bot/bot.py Outdated
@ghost ghost added s: waiting for author Waiting for author to address a review or respond to a comment and removed needs 2 approvals labels 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).
@ghost ghost added needs 2 approvals and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Jul 31, 2020
@coveralls
Copy link
Copy Markdown

coveralls commented Nov 21, 2020

Coverage Status

Coverage decreased (-0.1%) to 56.442% when pulling 66ea8a3 on ks129:bug-fixes into a5f09a8 on python-discord:master.

Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py Outdated
Comment thread bot/bot.py Outdated
@ghost ghost added s: waiting for author Waiting for author to address a review or respond to a comment and removed needs 2 approvals labels Nov 27, 2020
@ghost ghost added needs 2 approvals and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Dec 2, 2020
@ks129 ks129 requested a review from MarkKoz December 2, 2020 16:46
Comment thread bot/exts/moderation/watchchannels/_watchchannel.py Outdated
Comment thread bot/exts/moderation/infraction/_scheduler.py
Copy link
Copy Markdown
Contributor

@Xithrius Xithrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ks129 ks129 merged commit 6e440d9 into python-discord:master Dec 29, 2020
@ks129 ks129 deleted the bug-fixes branch December 29, 2020 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: information Related to information commands: (doc, help, information, reddit, site, tags) a: moderation Related to community moderation functionality: (moderation, defcon, verification) p: 3 - low Low Priority t: bug Something isn't working

Projects

None yet

4 participants