aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2021-01-04HelpChannels: fix manual use of lock decoratorGravatar MarkKoz-3/+3
2021-01-04HelpChannels: fix race condition when unclaiming a channelGravatar MarkKoz-0/+1
Place a channel-specific lock on `unclaim_channel`. If both the dormant task and the command simultaneously unclaim a channel, one of them will silently be aborted. Fix #1341
2021-01-04HelpChannels: change caller str parameter to a boolGravatar MarkKoz-11/+12
Booleans are less error-prone than strings.
2021-01-04HelpChannels: unschedule the dormant task in unclaim_channelGravatar MarkKoz-2/+5
Ensure the cancellation will be under the lock once the lock is added.
2021-01-04HelpChannels: clarify close command docstringGravatar MarkKoz-2/+1
Referencing internal functions in public-facing documentation is not helpful to users.
2021-01-04HelpChannels: refactor the close command checkGravatar MarkKoz-10/+10
2021-01-04HelpChannels: make a channel available within the lockGravatar MarkKoz-5/+6
If the lock causes the function to abort, a new channel shouldn't be made available. However, the only way to know it's aborted from the outside would be through a return value or global variable. Neither seem as nice as just just using `create_task` within the lock to avoid having `move_to_available` hold the lock.
2021-01-04Add asyncio.create_task wrapper which logs exceptionsGravatar MarkKoz-0/+17
Normally exceptions are only logged when tasks are garbage collected. This wrapper will allow them to be logged immediately through a done callback. This is similar to how the Scheduler logs errors.
2021-01-04HelpChannels: fix race condition between claiming and unclaimingGravatar MarkKoz-1/+15
The race condition is when a user claims a channel while their other channel is being unclaimed. Specifically, it's while their cooldown is being removed. The lock ensures that either the cooldown will be re-applied after it's removed or that it won't be removed since `unclaim_channel` will see the user has another claimed channel.
2021-01-04Lock: support waiting until a lock is availableGravatar MarkKoz-37/+25
It's been determined that asyncio.Lock is safe to use in such manner. Therefore, replace LockGuard entirely with asyncio.Lock.
2021-01-04HelpChannels: refactor channel unclaimingGravatar MarkKoz-20/+19
Narrow the scope of `move_to_dormant` to just moving the channel. Following the design of `claim_channel`, make `unclaim_channel` handle cooldowns and unpinning.
2021-01-04HelpChannels: remove obsolete channel position trace logGravatar MarkKoz-1/+0
2021-01-04HelpChannels: refactor stat trackingGravatar MarkKoz-27/+47
Move significant code related to stats to a separate module.
2021-01-04HelpChannels: move function to the channel moduleGravatar MarkKoz-42/+45
2021-01-04HelpChannels: prevent user from claiming multiple channels quicklyGravatar MarkKoz-0/+1
It's conceivable for a user to be able to quickly send a message in all available channels before the code has a chance to add the cooldown role. Place a lock on the author to prevent the claim code from running multiple times for the same user.
2021-01-04HelpChannels: await init task at the start of event listenersGravatar MarkKoz-4/+4
It feels safer to do this since the init task moves channels to different categories and the listeners check if channels are in certain categories.
2021-01-04HelpChannels: use a more accurate lock for messagesGravatar MarkKoz-47/+35
Use the `lock_arg` decorator to keep a separate lock for each channel rather than a single lock used by all messages. Separate the core logic in `on_message` into a separate function to facilitate the use of `lock_arg` - not everything in `on_message` needs to be under the lock.
2021-01-02Removed 'Optional' import.Gravatar xithrius-1/+1
2021-01-02Removed unnecessary debugging logs.Gravatar Xithrius-2/+0
Co-authored-by: Dennis Pham <[email protected]>
2021-01-02Set reason to default as an empty string.Gravatar Xithrius-5/+2
Co-authored-by: Dennis Pham <[email protected]>
2021-01-02No nominaton reason blank replaced by italic NoneGravatar xithrius-2/+4
2021-01-01Update discord.py to fix webhook message publishing.Gravatar Den4200-45/+60
Related to #1342.
2020-12-30"Pending: False" to "Verified: True" to agree with new semantics.Gravatar Steele-1/+1
2020-12-28Update raw command no permission error messageGravatar ks129-1/+1
Co-authored-by: Xithrius <[email protected]>
2020-12-27Enable raw commandGravatar ks129-2/+2
2020-12-27Add check does user can see channel in raw commandGravatar ks129-0/+4
2020-12-25`!user` command says if user is "Verified"Gravatar Steele-2/+2
Previously, `!user` said if the user is "Pending", whereas "Verified" is the boolean opposite.
2020-12-24`if user.pending` -> `if not user.pending`Gravatar Steele Farnsworth-1/+1
This was a logic error. This functionality is unfortunately difficult to test outside of production.
2020-12-23`ALTERNATE_VERIFIED_MESSAGE`: "You're" -> "You are".Gravatar Steele-1/+1
2020-12-23Move PEP cog to info extensions categoryGravatar ks129-0/+0
2020-12-23Move constants out from classGravatar ks129-5/+4
2020-12-22Rewrite `!verify` to account for new native-gate-only verification.Gravatar Steele-10/+11
Renamed method; if not `user.pending`, adds and immediately removes an arbitrary role (namely the Announcements role), which verifies the user.
2020-12-20Add the clear alias to the clean commandGravatar Matteo Bertucci-1/+1
2020-12-20Fix wrong way for getting Git SHAGravatar ks129-1/+1
2020-12-20Remove unused constantGravatar ks129-1/+0
2020-12-20Implement GitHub API authorization headerGravatar ks129-1/+9
2020-12-20Log warning and return early when can't get PEP URLs from APIGravatar ks129-0/+4
2020-12-20Make last PEPs listing refresh non-optionalGravatar ks129-1/+2
2020-12-20Set last PEPs listing at beginning of functionGravatar ks129-1/+1
2020-12-20Move PEP related functions and command to own cogGravatar ks129-136/+154
2020-12-20Add GitHub API key to config as environment variableGravatar ks129-0/+2
2020-12-20Remove aiohttp integrationGravatar ks129-2/+0
2020-12-20Use bot prefix instead pydis-bot for Sentry release workflowGravatar ks129-1/+1
2020-12-20Attach release on Sentry SDK initializationGravatar ks129-1/+2
2020-12-20Add constant for Git SHAGravatar ks129-0/+3
2020-12-20Inject Git SHA in container build workflowGravatar ks129-0/+2
2020-12-20Consume Git SHA build arg and add to it to environmentGravatar ks129-1/+5
2020-12-19Fix flake8 pre-commit hook running through PyCharmGravatar MarkKoz-1/+1
2020-12-19Remove obsolete test casesGravatar MarkKoz-8/+0
Forgot to remove these when removing `loop_is_running` in a previous commit.
2020-12-19APIClient: create the session directly in __init__Gravatar MarkKoz-21/+10
The client is already instantiated in a coroutine and aiohttp won't complain. Therefore, scheduling a task to create the session is redundant.