Skip to content

[BUG] exhausting per-route ratelimit breaks the bot  #770

@Wizzerinus

Description

@Wizzerinus

Describe the bug.

So I tried to register 7 or so slash commands in my guild, and I started getting "Invalid application command" errors. I run it with PYTHONASYNCIODEBUG=1 and the bot literally never launched. After some investigation, I see this:

The HTTP client has exhausted a per-route ratelimit. Locking route for 18.36 seconds.
a callable object was expected by call_at(), got None
Traceback (most recent call last):
  File "/home/wizzerinus/.local/share/virtualenvs/Event-Horizon-Dashboard-NcUfMB2N/src/discord-py-interactions/interactions/api/http/request.py", line 192, in request
    self._loop.call_later(reset_after, _limiter.release_lock())
  File "/home/wizzerinus/.pyenv/versions/3.9.9/lib/python3.9/asyncio/base_events.py", line 714, in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
  File "/home/wizzerinus/.pyenv/versions/3.9.9/lib/python3.9/asyncio/base_events.py", line 728, in call_at
    self._check_callback(callback, 'call_at')
  File "/home/wizzerinus/.pyenv/versions/3.9.9/lib/python3.9/asyncio/base_events.py", line 761, in _check_callback
    raise TypeError(
TypeError: a callable object was expected by call_at(), got None

so I look into the code and release_lock returns None, and should be passed as a function instead of as a return value 🙃
Seems to happen on both stable and unstable branches, too

List the steps.

  1. Enable PYTHONASYNCIODEBUG (optional, if you don't it just spams the error)
  2. Exhaust the per-route ratelimit in any way (it's also not hard because cooldown does not work)
  3. Enjoy bot crashes

What you expected.

bot correctly locks per-route requests and does not unlock them immediately

What you saw.

Instead, I received this traceback error given from my Python terminal: [see above]

What version of the library did you use?

unstable I think? it's pretty weird

Version specification

seems to be true on both stable and unstable, pipfile.lock says I have it at commit 1d3ec28

Code of Conduct

  • I agree to follow the contribution requirements.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions