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

bug: rate limiting not being handled #60

Open
mikeshultz opened this issue Oct 27, 2023 · 0 comments · May be fixed by #35
Open

bug: rate limiting not being handled #60

mikeshultz opened this issue Oct 27, 2023 · 0 comments · May be fixed by #35
Labels
category: bug Something isn't working

Comments

@mikeshultz
Copy link
Member

mikeshultz commented Oct 27, 2023

Environment information

  • ape and plugin versions:
$ ape --version
0.6.21

$ ape plugins list
Installed Plugins
  alchemy    0.6.5
  foundry    0.6.17
  vyper      0.6.11
  • Python Version: 3.11.5
  • OS: linux

What went wrong?

Trying to use this with a free tier Alchemy key and can't make it usable.

[...snip...]
  File "/path/to/venv/lib/python3.11/site-packages/ape/contracts/base.py", line 641, in range
    yield from self.query_manager.query(contract_event_query)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1392, in get_contract_logs
    for page in pool.map(fetch_log_page, block_ranges):
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1388, in fetch_log_page
    logs = self._get_logs(page_filter.dict(), raw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1399, in _get_logs
    return self._make_request("eth_getLogs", [filter_params])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape_alchemy/provider.py", line 200, in _make_request
    raise cls(message) from err
ape_alchemy.exceptions.AlchemyProviderError: Your app has exceeded its compute units per second capacity. If you have retries enabled, you can safely ignore this message. If not, check out https://docs.alchemy.com/reference/throughput

How can it be fixed?

I think it's critical to have HTTP retries (probably with a backoff) in this lib. This isn't a recoverable error or anything I can do about other than upgrading my Alchemy subscription.

Should be noted that Alchemy's own SDK implements retries and they recommend doing so if you implement your own provider.

I saw #35 which may be a path forward but it looks a bit stalled.

@mikeshultz mikeshultz added the category: bug Something isn't working label Oct 27, 2023
@wakamex wakamex linked a pull request Jan 25, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant