Skip to content

[Bug-Candidate]: retry HTTP 429 with exponential backoff and log error #229

@wjmelements

Description

@wjmelements

Describe the issue:

get_additional_linux_versions() can fail with HTTPError 429.

HTTP Error 429 should not be treated as a permanent failure. It should be retried with exponential backoff. The user should also be notified of the reason for this delay.

Code example to reproduce the issue:

pipenv run solc-select install 0.6.6 && pipenv run solc-select use 0.6.6

Version:

0.2.1

Relevant log output:

Run pipenv run solc-select install 0.6.6 && pipenv run solc-select use 0.6.6
Loading .env environment variables...
Traceback (most recent call last):
  File "/home/runner/.local/share/virtualenvs/<redacted>/bin/solc-select", line [8](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:9), in <module>
    sys.exit(solc_select())
             ^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/__main__.py", line 51, in solc_select
    install_artifacts(args.get(INSTALL_VERSIONS))
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 45, in install_artifacts
    releases = get_available_versions()
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 115, in get_available_versions
    available_releases.update(get_additional_linux_versions())
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 123, in get_additional_linux_versions
    github_json = urllib.request.urlopen(url).read()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 4[9](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:10)6, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.[11](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:12)/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions