Skip to content

Conversation

sirwolfgang
Copy link
Contributor

@sirwolfgang sirwolfgang commented Feb 1, 2023

Closes #121

Proposed Changes:

  • Remove Gemfile.lock, generally this should not be tracked in gems. If anything needs to be locked, it should be in the gemspec
  • Migrate to RedisClient
    • This is like 90% done; I've updated all the command calls, and most of the specs are passing.
    • The initialize process needs a pass, and Connection Pool support should be considered removed in favor of RedisClients 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 mperham
  • Bump to version 2.0.0 since breaking change
  • Reorder the loop on script loading, this should reduce connection usage

@san983
Copy link
Contributor

san983 commented Feb 4, 2023

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.

san983 and others added 2 commits February 4, 2023 11:38
Minium Redis version required for redis-client
@sirwolfgang
Copy link
Contributor Author

@san983 Just merged it in. Thanks for the support!

@sirwolfgang
Copy link
Contributor Author

@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 .with ConnectionPooler so this basically works as is.

@leandromoreira
Copy link
Owner

I usually left the Gemfile.lock because of the docker/ci running requiring something to run against.

Copy link
Owner

@leandromoreira leandromoreira left a 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

@leandromoreira leandromoreira merged commit b6e3031 into leandromoreira:main Feb 9, 2023
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)
Copy link
Contributor

@bf4 bf4 Feb 13, 2023

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

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a PR #125

begin
yield
rescue Redis::CommandError => e
rescue RedisClient::CommandError => e
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, see #126

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

Successfully merging this pull request may close these issues.

Plan for switching to RedisClient

5 participants