Open dnlwgnd opened 2 years ago
I believe this is intended redis-py implementation. Are you able to reproduce on redis-py? If so, please file there as we will follow suit. I don't really have an opinion on this (nor the time at the moment). Please cc me via the @ symbol!
Describe the bug
I am using aioredis as a redis client in an async FastAPI app. In a specific usecase I do have a websocket server-endpoint in which I want to listen for subscribe-messages (that is just a json string) from my websocket-client. I then need to setup a pubsub instance with the appropriate subscriptions for which I want to supply an callback handler function. Those subscribe-messages can come at any point in time, so especially in the very beginning there is no subscription at all (until I receive the first such message)
A the time the websocket session opens, I also create the pubsub object via redis_client.pubsub(). I also submit a task to the asyncio event queue for the pubsub.run() function, that is supposed to call my callback of the subscriptions.
Now I do get an error when creating that task:
I do not get an error, if I setup one or more subscriptions in the pubsub instance before calling run(). However, I feel this should still be possible and should not give an error.
To Reproduce
This is what I do in a standard asyncio environment:
Expected behavior
The run() task should just run, even if there are no subscriptions and thus no handlers available.
Logs/tracebacks
Python Version
aioredis Version
Additional context
No response
Code of Conduct