-
Notifications
You must be signed in to change notification settings - Fork 538
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
Deprecate aio::Connection
#889
Conversation
It should be noticed that if we don't type-erase pubsub & monitor, then replacing their internal implementation will still be semver-breaking. |
@jaymell I'll fix the CI errors once you give the go-ahead to the general direction of this PR, ok? |
I think this is a great approach and badly needed! Would love to get it out ASAP, honestly. As for using traits, I'm not opposed to it, though also not sure it's totally necessary? I'm also curious to see what the performance difference is of using a multiplexed connection to back this. ... If we continue to use |
I don't know another way to avoid semver breaking when changing an implementation. If care about maintaining the same API, then traits aren't needed, but I don't know about a way to change types without breaking semver and without using dyn traits.
I don't think that's possible. multiplexed connections work by pushing requests and receiving a oneshot channel carrying a IMO |
Yeah point taken. I guess I'm curious if we were to bolt streaming response functionality to the multiplexed connection, could we live with one implementation of the connection. Could we potentially have an implementation for pub-sub similar to what you have here that essentially wraps the multiplexed connection but doesn't allow cloning? Just thinking out loud here. |
Using #898 we could tweak multiplexed connection to always send on the push manager when its in PubSub mode, and use this design. The problem is that it'll make the struct behave in two completely different ways, depending on the mode of usage, which IMO means the gains from using the same struct are minor. I'm not even sure that some hypothetical future bug fix could be applied to both modes. BUT I'm saying this after very little research. This isn't a well informed, thoroughly researched take :) |
`aio::Connection` is deprecated due to it entering erroneous state when user drops its futures before they complete (similar to OpenAI's [RedisPy issue](https://openai.com/blog/march-20-chatgpt-outage)). PubSub & monitor, which are built on top of `aio::Connection`, are now exposed for direct creation from a `client`, in order to allow us to transition their implementation to another backing connection.
e47a5ed
to
c06419b
Compare
c06419b
to
4a918bd
Compare
|
||
/// Returns an async receiver for pub-sub messages. | ||
#[cfg(any(feature = "tokio-comp", feature = "async-std-comp"))] | ||
// TODO - do we want to type-erase pubsub using a trait, to allow us to replace it with a different implementation later? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd like to make these traits instead, I think we should do it.
aio::Connection
is deprecated due to it entering erroneous state when user drops its futures before they complete (similar to OpenAI's RedisPy issue).PubSub
&Monitor
, which are built on top ofaio::Connection
, are now exposed for direct creation from aclient
, in order to allow us to transition their implementation to another backing connection.