Skip to content

More visibility on rate limits when some actions get rate limited for a long time (>5 minutes or even >30 minutes) #2320

@waijie666

Description

@waijie666

Summary

I perform ClientUser.edit too frequently (more than 2 times for username change per hour) and getting rate limited. However I was waiting for quite some time (more than 10 minutes) and command not finishing and I am not getting any warning/error messages until I go enable debug logs.

Reproduction Steps

Just run this more than 2 times per hour

await self.bot.user.edit(username=username, avatar=binarybytes)

Expected Results

I expect to see some logs at WARNING level at least in the logging if the rate limit for retry is more than 5 minutes and in this case, it's almost one hour, so I wouldn't need to enable debug logs to find out the rate limit for this. I will let the devs decide the threshold but it should be at least something.

Actual Results

I had to enable logging.DEBUG to find out what's the issue.

2019-08-23 14:05:43,428:discord.http.DEBUG:A rate limit bucket has been exhausted (bucket: PATCH:None:None:/users/@me, retry: 2245.0).
2019-08-23 14:05:43,429:discord.client.DEBUG:Dispatching event command_error
Ignoring exception in command idol_change:
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/discordbot-aikatsup-search-rTcs97OV/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "/backup/scripts_dir/discordbot-aikatsup-search/discordbot-aikatsup-search/cogs/test.py", line 386, in idol_change
    await self.idol_change_function(ctx, idol)
  File "/backup/scripts_dir/discordbot-aikatsup-search/discordbot-aikatsup-search/cogs/test.py", line 408, in idol_change_function
    await self.bot.user.edit(username=idol_dict[idol],avatar=binarybytes)
  File "/root/.local/share/virtualenvs/discordbot-aikatsup-search-rTcs97OV/lib/python3.7/site-packages/discord/user.py", line 457, in edit
    data = await http.edit_profile(**args)
  File "/root/.local/share/virtualenvs/discordbot-aikatsup-search-rTcs97OV/lib/python3.7/site-packages/discord/http.py", line 222, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 BAD REQUEST (error code: 50035): Invalid Form Body
In username: You are changing your username or Discord Tag too fast. Try again later.

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

System Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis is not right.questionThis is a question about the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions