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

Add redis sentinel support #107

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Add redis sentinel support #107

merged 1 commit into from
Oct 4, 2024

Conversation

jaymell
Copy link
Contributor

@jaymell jaymell commented Oct 3, 2024

There are a few breaking changes made to support this.
Most notably, the an optional SentinelConfig struct
has been added to the RedisConfig object. It seems like
obfuscating the fields here might be a good idea, but
that's not how we've been rolling thus far with the
config objects.

Also, the RedisConnection trait has been redone
to take a RedisConfig instead of a DSN in order
to build the connection. Sentinel needs it owing
to the large number of potential config params needed
for Sentinel, and I think this is probably a better
approach anyway.

The base redis tests (well, most of them) have also
been updated to support testing against either
base Redis or Sentinel. The rstest crate has been
added in order to be able to parameterize the tests
sanely. We also use this crate for tests in redis-rs,
so I think it's a no-brainer to add here.

@jaymell jaymell force-pushed the redis-sentinel branch 2 times, most recently from 55f3bcc to 1feda18 Compare October 3, 2024 21:02
@jaymell jaymell marked this pull request as ready for review October 3, 2024 21:14
@jaymell jaymell requested a review from a team as a code owner October 3, 2024 21:14
@tasn
Copy link
Member

tasn commented Oct 3, 2024

Is the breaking change only when sentinel is enabled?

@jaymell
Copy link
Contributor Author

jaymell commented Oct 3, 2024

Is the breaking change only when sentinel is enabled?

No. We could potentially add a field that's dependent on the feature, but I think a better approach is to stop making config fields public and instead switch to builders. This will cause some issues downstream with Bridge IIRC, but that's something that I'm guessing should be fixable.

There are a few breaking changes made to support this.
Most notably, the an optional `SentinelConfig` struct
has been added to the RedisConfig object. It seems like
obfuscating the fields here might be a good idea, but
that's not how we've been rolling thus far with the
config objects.

Also, the `RedisConnection` trait has been redone
to take a `RedisConfig` instead of a DSN in order
to build the connection. Sentinel needs it owing
to the large number of potential config params needed
for Sentinel, and I think this is probably a better
approach anyway.

The base redis tests (well, most of them) have also
been updated to support testing against either
base Redis or Sentinel. The `rstest` crate has been
added in order to be able to parameterize the tests
sanely. We also use this crate for tests in `redis-rs`,
so I think it's a no-brainer to add here.
Copy link
Contributor

@svix-onelson svix-onelson left a comment

Choose a reason for hiding this comment

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

The parameterized tests look great.

omniqueue/src/backends/redis/sentinel.rs Show resolved Hide resolved
@svix-james svix-james merged commit 75e5a95 into svix:main Oct 4, 2024
5 checks passed
@jaymell jaymell deleted the redis-sentinel branch October 4, 2024 18:22
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