-
Notifications
You must be signed in to change notification settings - Fork 30
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
Resolve pubsub future only when nothing can happen anymore #72
base: master
Are you sure you want to change the base?
Conversation
.unwrap(); | ||
} | ||
return Err(error::Error::Connection(ConnectionReason::NotConnected)); | ||
// This can only happen if the connection is closed server-side |
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.
Here I removed the handling of the special case, because I couldn't think of a reason to keep it. Am I missing anything?
} | ||
|
||
#[tokio::test] | ||
async fn test_connection_is_closed_after_channel_is_dropped() { |
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.
I had to do this test outside the test
module, to have access to the private types. Is there a better way?
Any chance this PR could be accepted ? |
With these changes
PubsubConnectionInner
should complete only if everyPubsubConnection
have been dropped.It should be enough to guarantee that:
PubsubStream
keeps a reference toPubsubConnection
and unsubscribes when dropped)PubsubConnection
)PubsubConnection
to do that)Fixes #50