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

Administrative commands cannot be effectively namespaced - deprecation warning #132

Closed
djones opened this issue Mar 11, 2017 · 8 comments
Closed

Comments

@djones
Copy link

djones commented Mar 11, 2017

I'm seeing:

Passing 'flushdb' command to redis as is; administrative commands cannot be effectively namespaced and should be called on the redis connection directly; passthrough has been deprecated and will be removed in redis-namespace 2.0

When running:

ratelimit.send(:redis).flushdb

I noticed issues #130 #122 #111 #97 are all related to the same warning. I tried out the suggested work around in #111 but it doesn't work for me.

In my particular case this code runs in our test suite and in this context I'm not concerned if namespacing is effective or not.

Perhaps the warning message could help guide us to a fix?

@djones
Copy link
Author

djones commented Mar 11, 2017

Redis.current.flushdb

has fixed the issue for me. I still wonder though if there's a way we can empower those who see the warning with some details on possible alternatives.

@mjnguyenloyalty
Copy link

Redis.current.redis.flushdb is what worked for me. (Redis.current.flushdb didn't)

@mikeheft
Copy link

mikeheft commented Jan 22, 2018

Neither worked for me, but I'm also using gem mock_rails not sure if that is causing a problem.

unless Rails.env.test?
  $REDIS = Redis::Namespace.new('recommendation_api',
                               redis: Redis.new(host: Rails.application.config.redis_host, port: 6379, db: 0))
else
  $REDIS = Redis::Namespace.new('recommendation_api', redis: MockRedis.new)
end

EDIT: $REDIS.redis.flushdb got it to work for me

@gonzoinc
Copy link

TBH These depreciation warning should be completely removed. This is nothing more than log spam. Some of us use modules that pull redis-namespace in on build and are now stuck dealing with this log spam with zero possible ways to turn it off (since it pulls in from third party gems). I have hundreds of these depreciation warnings spamming my logs every second which makes it pretty much impossible to use my logs within needing to parse out this spam.

These should be behind a development toggle of some sort so that those running this in production environments can turn this spam off.

@rafaelfranca
Copy link
Member

How about fixing the places that are generating those deprecation warnings?

You can also disable them yourself by using the Warning module in Ruby.

@gonzoinc
Copy link

@rafaelfranca My code is not using it directly, external modules used are pulling it in elsewhere which I don't have access to. I.E. Not My Code! They are also locked to specific versions and will not be using 2.0 so depreciation warning doesn't apply hence log spam.

Disable warning only applies when your not debugging. I can easily disable it when I'm not working on it, but when debugging is when you have no control over disabling the log spam.

I could just as easily fork this, remove the log spam and pull it from our internal Artifactory repo, but as it seems to be a headache for more than just me maybe it should be removed.

@dtmunir
Copy link

dtmunir commented Jul 25, 2018

Agree with @gonzoinc -- why can't these warnings be behind some development flag? No one is looking for these in production

@rafaelfranca
Copy link
Member

You can do that by using the Warning module in Ruby. https://ruby-doc.org/core-2.5.0/Warning.html

Those warnings will be still in the library until the offending code is removed. I recommend you to report to the libraries that are calling those methods so they fix the issue before the behavior is removed.

Thank you for the issue.

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

6 participants