Elixir Tools uses the GitHub unauthenticated API to check for new releases of the "tools" every time the editor is started and plugin is loaded. For users of ElixirLS, NextLS and Credo LSP that's 3 calls total on every start.
Whenever reaching the API rate limit of the GitHub unauthenticated API, ElixirTools fails to start.
Reproduction Steps
Reach the rate limit of unauthenticated API calls (to simulate this, call the API as the plugin does, but repeat 60 times):
Alternatively, we can find a way to use the developer's GitHub auth token as part of the request, which will then increase the rate limit to 5,000 per hour which is less likely to be hit, but that seems a tad more complicated.
I'm happy to post a PR for this if my first solution sounds like a good approach.
Summary
Elixir Tools uses the GitHub unauthenticated API to check for new releases of the "tools" every time the editor is started and plugin is loaded. For users of ElixirLS, NextLS and Credo LSP that's 3 calls total on every start.
Whenever reaching the API rate limit of the GitHub unauthenticated API, ElixirTools fails to start.
Reproduction Steps
Expected
The Elixir file opens and a notification shows that the latest version of ElixirLS/CredoLS/NextLS cannot be checked due to a rate limit
Actual
ElixirTools fails to start with this error:
This breaks all LSP functionality
Cause
This error originates from this line https://github.com/elixir-tools/elixir-tools.nvim/blob/883933b57c9150c71ad2b99a4080685d83e095b8/lua/elixir/utils.lua#L55
I confirmed this was due to a rate limit being hit
And it is likely due to the assumption that
curl
would return an error code in this case, but it does not:From GitHub rate limiting docs:
Suggested Solution
--fail
to the curl command inlatest_release
, to make it return an error code on failed attemptsAlternatively, we can find a way to use the developer's GitHub auth token as part of the request, which will then increase the rate limit to 5,000 per hour which is less likely to be hit, but that seems a tad more complicated.
I'm happy to post a PR for this if my first solution sounds like a good approach.