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

Calling subscribe() multiple times on PubSubStream with the same channel results in an error on close() #59

Closed
richardhenry opened this issue Mar 12, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@richardhenry
Copy link
Contributor

richardhenry commented Mar 12, 2024

If you call subscribe() on PubSubStream multiple times with the same channel the following assertion error will occur when close() is called on the PubSubStream (or when it is dropped):

thread 'rocket-worker-thread' panicked at .../src/index.crates.io-6f17d22bba15001f/rustis-0.12.8/src/network/network_handler.rs:545:17:
[localhost:6379] Received unexpected message: Ok(Push([BulkString("unsubscribe"), BulkString("[channel name]"), Integer(0)]))

This is fixed by maintaining a hash set of channels in my application code and checking if the channel is already subscribed before calling subscribe, which is a good thing to do anyway — but this would probably be good to fix in Rustis too.

@richardhenry richardhenry changed the title Calling subscribe() multiple times on PubSubStream with the same channel results in an error on close() Calling subscribe() multiple times on PubSubStream with the same channel results in an error on close() Mar 12, 2024
@mcatanzariti
Copy link
Member

Hi @richardhenry,

I could Indeed create a dedicated error that would be returned by PubSubStream::subscribe if a subscription already exist on the requested channel.

Cheers,

Michaël

@mcatanzariti mcatanzariti self-assigned this Mar 16, 2024
@mcatanzariti mcatanzariti added the bug Something isn't working label Mar 16, 2024
mcatanzariti added a commit that referenced this issue Mar 16, 2024
@mcatanzariti
Copy link
Member

fixed in 4109e8a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants