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

Replace use of r2d2 with redis-rs ConnectionManager #18

Merged
merged 2 commits into from
Sep 1, 2022

Conversation

lfittl
Copy link
Contributor

@lfittl lfittl commented Jul 28, 2022

Using r2d2 with redis isn't really necessary, as the redis crate can
multiplex a connection, and in fact its the recommended approach for most
use cases: redis-rs/redis-rs#388 (comment)

Therefore this changes things to use redis-rs internally, with the intent
of adding an async API to this crate in the future. Additionally this
enables TLS for Redis connections, to support Redis servers that require
TLS.

This change is mostly API-compatible, but does change the underlying
RedisPool type (its still called "pool", but its actually a
ConnectionManager), and drops the exported type RedisPooledConnection.

@lfittl lfittl force-pushed the connection-manager branch from feb8366 to 9292230 Compare July 28, 2022 04:28
Using r2d2 with redis isn't really necessary, as the redis crate can
multiplex a connection, and in fact its the recommended approach for most
use cases: redis-rs/redis-rs#388 (comment)

Therefore this changes things to use redis-rs internally, with the intent
of adding an async API to this crate in the future. Additionally this
enables TLS for Redis connections, to support Redis servers that require
TLS.

This change is mostly API-compatible, but does change the underlying
RedisPool type (its still called "pool", but its actually a
ConnectionManager), and drops the exported type RedisPooledConnection.
@lfittl lfittl force-pushed the connection-manager branch from 9292230 to 8b1f259 Compare July 28, 2022 04:31
This otherwise errors out with an error like this, since you can't
use block_on inside another block_on:

"cannot execute `LocalPool` executor from within another executor"
@lfittl lfittl force-pushed the connection-manager branch from 8547860 to 8a85a0b Compare July 28, 2022 05:26
Copy link
Owner

@spk spk left a comment

Choose a reason for hiding this comment

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

Thanks!

@spk spk merged commit 88e1e23 into spk:master Sep 1, 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.

2 participants