Skip to content
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

Fix `cog_unload` bug in WatchChannel ABC #483

Merged
merged 2 commits into from Oct 2, 2019

Conversation

@SebastiaanZ
Copy link
Member

commented Oct 2, 2019

There was small bug in the cog_unload method of the WatchChannel ABC. The reason is that it tries to check if the Task assigned to self._consume_task is done by accessing its done method without ensuring that self._consume_task has been assigned to an actual Task yet.

My solution is to change the if condition to this:

if self._consume_task and not self._consume_task.done():

This pull request closes #482

#482

There was small bug in the `cog_unload` method of the WatchChannel
ABC in `bot.cogs.watchchannels.watchchannel`. The problem was that it
tries to check if the Task assigned to `self._consume_task` is done
by accessing its `done` method. However, if a watch channel has not
yet relayed messages after the bot has started, it will not have a
consumption task yet, meaning this `_consume_task` attribute will be
assigned to `None`.

The solution is to change the `if` condition to:

  `if self._consume_task and not self._consume_task.done():`

This commit closes #482
@MarkKoz
MarkKoz approved these changes Oct 2, 2019
@sco1
sco1 approved these changes Oct 2, 2019
@sco1 sco1 merged commit 58312af into master Oct 2, 2019
2 checks passed
2 checks passed
Bot Build #20191002.27 succeeded
Details
Bot (Lint & Test) Lint & Test succeeded
Details
@sco1 sco1 deleted the fix-watchchannels-unload-cog-bug branch Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.