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

Make RedisConnection Check Require Redis Instance Parameter #39

Merged
merged 4 commits into from
Feb 21, 2022

Conversation

kylesnowschwartz
Copy link
Contributor

Redis-rb, the Redis gem used by Rails apps, is deprecating a part of its
API which stores a global Redis connection. See
redis/redis-rb#1064 for context around that
deprecation.

To prepare for when this behavior will be removed, we must update this
application so that Redis will be passed in as an instance to be
checked, because it will not be globally available.

See https://github.com/envato/marketplace/pull/29383 for more information

Copy link

@BlakeJohnCarter BlakeJohnCarter left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@petervandoros petervandoros left a comment

Choose a reason for hiding this comment

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

Nice work. I've left a minor comment about naming the instance variable, but I also think we need to add an entry to the changelog and make the necessary changes to bump the gem version.

class RedisConnection
attr_reader :instance_parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming this to something more accurate. E.g., redis_instance?

Copy link
Contributor

Choose a reason for hiding this comment

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

The sequel check uses connection_parameters to indicate that it takes the necessary parameters to construct a sequel database instance — I'm wondering if we should take the same approach here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given the possible complexity with redis connection handling (e.g., connection pooling), I'm thinking it's probably best to pass the redis instance this check should use. Leaving that complexity to the app keeps this check simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've gone ahead and renamed to redis_instance which conveys what is being passed in via the parameters hash more clearly.

@liamdawson
Copy link
Contributor

Sorry to make extra work for you @kylesnowschwartz, but I've just merged my other long-standing PR that includes changes to the README file — do you mind editing the README to reflect the configuration changes as part of this PR?

Redis-rb, the Redis gem used by Rails apps, is deprecating a part of its
API which stores a global Redis connection. See
redis/redis-rb#1064 for context around that
deprecation.

To prepare for when this behavior will be removed, we must update this
application so that Redis will be passed in as an instance to be
checked, because it will not be globally available.
Simpler name conveys what this variable is
@kylesnowschwartz kylesnowschwartz force-pushed the add_instance_parameters_to_redis_check branch from b1aa3bb to 4728499 Compare February 21, 2022 01:02
@liamdawson liamdawson added this to the 0.2.0 milestone Feb 21, 2022
@kylesnowschwartz
Copy link
Contributor Author

@petervandoros does this require pumping the version from 0.1.0 to 0.2.0 because of the breaking API change?

Copy link
Contributor

@liamdawson liamdawson left a comment

Choose a reason for hiding this comment

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

One thing I'd change about the API documentation, but otherwise LGTM

lib/rack/ecg/check/redis_connection.rb Outdated Show resolved Hide resolved
@liamdawson
Copy link
Contributor

@kylesnowschwartz I'll handle bumping the version, as I have one more change I want to include for the next release (deprecating the built-in git_revision check)

Update API documentation with correct types

Co-authored-by: Liam Dawson <liam.dawson@envato.com>
@kylesnowschwartz kylesnowschwartz merged commit 26632d9 into main Feb 21, 2022
@orien orien deleted the add_instance_parameters_to_redis_check branch February 5, 2024 21:12
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.

4 participants