-
Notifications
You must be signed in to change notification settings - Fork 81
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
Upgrade to RedisClient #122
Conversation
Hey @sirwolfgang, this looks nice! Just opened sirwolfgang#1 to have CI passing. Also moving to RedisClient will make it compatible just Redis 6.0+, so made an update in README.md too. |
Minium Redis version required for redis-client
Spec fix + Update README.md
@san983 Just merged it in. Thanks for the support! |
@leandromoreira Can you give this a look over? I think it should be good to go, and cut the new version. The redis-client native connection pooler stuff is compatible via |
I usually left the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great, thank you so much
end | ||
@redis.extend(ConnectionPoolLike) | ||
end | ||
end | ||
|
||
def lock(resource, val, ttl, allow_new_lock) | ||
recover_from_script_flush do | ||
@redis.with { |conn| conn.evalsha Scripts::LOCK_SCRIPT_SHA, [resource], [val, ttl, allow_new_lock] } | ||
@redis.call('EVALSHA', Scripts::LOCK_SCRIPT_SHA, 1, resource, val, ttl, allow_new_lock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to debug why are locks aren't being made successfully while testing upgrade from 1.3.2 to 2.0.0
I think behavior here changed since the change to call doesn't return anything and therefore servers.select { lock }.size never returns a lock as found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed that since I'm passing in a redis client with a connection pool, it would work as @redis.with { |conn| conn.call .... }
but not @redis.call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a PR #125
end | ||
end | ||
|
||
def recover_from_script_flush | ||
retry_on_noscript = true | ||
begin | ||
yield | ||
rescue Redis::CommandError => e | ||
rescue RedisClient::CommandError => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems we probably want to rescue RedisClient::ConnectionError
here redis-rb/redis-client#92 (comment)
noting https://github.com/redis/redis-rb/blob/v5.0.6/lib/redis/client.rb#L7-L19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, see #126
Closes #121
Proposed Changes:
Gemfile.lock
, generally this should not be tracked in gems. If anything needs to be locked, it should be in thegemspec
RedisClient
s native pooler; My understanding is this is what sidekiq 7 is doing, since it dropped support for Connection Pool; and both gems are written by mperham2.0.0
since breaking change