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

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

Closed
3 tasks done
waijie666 opened this issue Aug 23, 2019 · 1 comment
Labels
invalid This is not right. question This is a question about the library

Comments

@waijie666
Copy link

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

@Rapptz Rapptz added invalid This is not right. question This is a question about the library labels Aug 23, 2019
@Rapptz
Copy link
Owner

Rapptz commented Aug 23, 2019

  1. You're eating errors somewhere.
  2. Use an error handler: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#error-handling

@Rapptz Rapptz closed this as completed Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This is not right. question This is a question about the library
Projects
None yet
Development

No branches or pull requests

2 participants