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

Never required class is being used #79

Open
sergio-bobillier opened this issue Mar 12, 2024 · 0 comments
Open

Never required class is being used #79

sergio-bobillier opened this issue Mar 12, 2024 · 0 comments

Comments

@sergio-bobillier
Copy link

sergio-bobillier commented Mar 12, 2024

This issue refers to the file lib/elastic/transport/transport/errors.rb On line 27 the file declares the following class:

# Reloading connections timeout (1 sec by default)
#
class SnifferTimeoutError < Timeout::Error; end

However, the file never requires timeout which means that if nothing else is requiring timeout the following error happens:

NameError: uninitialized constant Elasticsearch::Transport::Transport::Timeout
from /usr/share/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/elasticsearch-transport-7.9.0/lib/elasticsearch/transport/transport/errors.rb:28:in `<module:Transport>'

In our case, this happens because we have a small class to handle Elasticsearch errors, so we are directly requiring elasticsearch/transport/transport/errors and hence we are getting this error. Mostly when executing a single spec file instead of the whole test suite.

This is not a particularly nasty issue, but classes should, in general, require other classes that they are using.

NOTE: Note that here the error shows elasticsearch-transport instead of elastic-transport. The issue was there before the repository was split, and it is still there in the new repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant