resque / redis-namespace

This gem adds a Redis::Namespace class which can be used to namespace Redis keys.
http://redis.io
MIT License
695 stars 192 forks source link

Deprecation warning: `Redis#sadd` will always return an Integer in Redis 5.0.0. Use `Redis#sadd?` instead #216

Closed fsanggang closed 1 year ago

fsanggang commented 2 years ago

I am using redis 4.8.0 and redis-namespace 1.9.0 and noticed this deprecation warning.

travisbell commented 1 year ago

Yup, on a worker boot, we get the following on Redis 4.8:

Redis#sadd will always return an Integer in Redis 5.0.0. Use Redis#sadd? instead.(called from: /usr/local/bundle/gems/redis-namespace-1.9.0/lib/redis/namespace.rb:479:in `call_with_namespace')
radar commented 1 year ago

@iloveitaly I will send you $20USD if you fix this issue.

iloveitaly commented 1 year ago

@radar good to see your name pop up again :)

I'm so short on time—will merge a PR that fixes this, but don't have time to do this myself. Sorry!

radar commented 1 year ago

Easy peasy :) See #217.

nickgrim commented 1 year ago

I don't think #217 has fully fixed this; I'm running 1.10.0 and still seeing this in my tests:

Redis#sadd will always return an Integer in Redis 5.0.0. Use Redis#sadd? instead.(called from: /usr/local/bundle/gems/redis-namespace-1.10.0/lib/redis/namespace.rb:558:in `wrapped_send')
rohitpaulk commented 1 year ago

We were seeing the deprecation notice after upgrading to 1.10.0 too. For those stumbling upon this: we fixed the issue by upgrading to v5 of the Redis gem, which doesn't have this deprecation notice.

smtlaissezfaire commented 1 year ago

Upgrading to v5 works but breaks ActionCable under rails 6. ActionCable.server.broadcast("foo", "bar") leads to an error. How have others fixed it?

Jakanapes commented 1 year ago

Upgrading to v5 works but breaks ActionCable under rails 6. ActionCable.server.broadcast("foo", "bar") leads to an error. How have others fixed it?

Curious what the error with AC was. We tried to bump to redis v5 and had intermittent Protocol errors https://github.com/redis/redis-rb/issues/1185

So I reverted and have been slowly trying to upgrade our redis/resque ecosystem to see when the issue is introduced.

You can count me among those running redis 4.8.1 and redis-namespace 1.10.0 and still seeing the deprecation warning

PatrickTulskie commented 1 year ago

@Jakanapes deprecation warnings should be fixed in 1.11.0... but if not lemme know or if you want just pop a PR to cover them that's cool too.

grosscr commented 1 year ago

This is still occurring for me, but it's tracing back to a different part of redis_namespace

Redis#sadd will always return an Integer in Redis 5.0.0. Use Redis#sadd? instead.(called from: /usr/local/Cellar/asdf/0.8.0/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/redis-namespace-1.11.0/lib/redis/namespace.rb:564:in `wrapped_send')

redis (4.8.1) redis-namespace (1.11.0)

seems to trace back to our use of the multi method, which i've included (modifying the key/variable names for obscurity)

  redis.multi do |r| 
      r.set key1, value1
      r.expireat key1, expiration

      r.set key2, value2
      r.expireat key2, expiration

      if value3
        r.set key3, value3
        r.expireat key3, expiration
      end
  end