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

Check that decorated connection responds to open_transactions before invoking #324

Closed

Conversation

rosa
Copy link
Contributor

@rosa rosa commented Jul 6, 2021

We have an instance of a Makara proxy we use for Redis, for read-write splitting. It looks like this:

class RedisProxy < Makara::Proxy

  # ...

  def connection_for(config)
    Redis.new(config)
  end

  # ...
end

The connection returned is an instance of a Redis client, which doesn't respond to open_transactions, so after updating to v0.5.1, any errors on Redis that would result in a Makara::Errors::BlacklistConnection, now result in a Redis::CommandError: ERR unknown command 'open_transactions'.

This PR addresses this. Let me know if you'd prefer an alternative approach or anything else!

…invoking

An `ActiveRecord::Base.connection` responds to this but other
connections such as for example a Redis client do not.
@jorgemanrubia
Copy link

Any chance we can get this merged 🙏?

Copy link
Contributor

@jeremy jeremy left a comment

Choose a reason for hiding this comment

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

Test case to demonstrate support and catch regression?

Copy link
Member

@mlarraz mlarraz left a comment

Choose a reason for hiding this comment

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

This looks good to me but as stated above an extra spec would be nice here.

@lewispb
Copy link

lewispb commented Jan 11, 2022

As discussed with @rosa, work continues in #341

@rosa rosa closed this Jan 11, 2022
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.

5 participants