diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-03-09 21:12:09 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-03-09 21:16:58 +0000 |
commit | 8cdeb0a316628f2e581e66e0c72442ac23c56a74 (patch) | |
tree | 6078c8a399a191a2c940d577d93a6d8df2fafa01 /question_of_the_day/question_of_the_day.py | |
parent | 118f7d22503fc8c2c9499103af6f1b430113221d (diff) | |
download | aps-cogs-8cdeb0a316628f2e581e66e0c72442ac23c56a74.tar aps-cogs-8cdeb0a316628f2e581e66e0c72442ac23c56a74.tar.gz aps-cogs-8cdeb0a316628f2e581e66e0c72442ac23c56a74.zip |
question_of_the_day: use get_member in paginate_questions
Repeatedly running `fetch_member` is making this operation take a very
long time, scaling with the number of questions present in the list. In
practice, roughly 8 seconds was observed for just 22 questions when
calling `qotd list`. Switching to `get_member` makes this
near-instantaneous.
Diffstat (limited to 'question_of_the_day/question_of_the_day.py')
-rw-r--r-- | question_of_the_day/question_of_the_day.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/question_of_the_day/question_of_the_day.py b/question_of_the_day/question_of_the_day.py index 1a0f74b..a307552 100644 --- a/question_of_the_day/question_of_the_day.py +++ b/question_of_the_day/question_of_the_day.py @@ -418,7 +418,7 @@ class QuestionOfTheDay(commands.Cog): "\n".join( [ f"{i + 1}. {redbot.core.utils.chat_formatting.bold(question['question'])} by " - + (await ctx.guild.fetch_member(question["asked_by"])).name + + (ctx.guild.get_member(question["asked_by"])).name + f" ({question['asked_by']})" for i, question in enumerate(questions) ] |