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

Cannot use AsyncRedis?? #771

Closed
ahmetkca opened this issue Aug 23, 2021 · 3 comments
Closed

Cannot use AsyncRedis?? #771

ahmetkca opened this issue Aug 23, 2021 · 3 comments
Assignees

Comments

@ahmetkca
Copy link

class MySocketManager:
	def __init__(self, app: FastAPI) -> None:
		self._mgr = socketio.AsyncRedisManager(REDIS_TLS_URL)
		self._sio: AsyncServer = socketio.AsyncServer(
			client_manager=self._mgr, 
			async_mode=ASYNC_MODE, 
			cors_allowed_origins='*'
		)
		self._app = socketio.ASGIApp(
			socketio_server=self._sio,
			socketio_path=SOCKETIO_PATH
		)
		app.mount(MOUNT_LOCATION, self._app)
		app.sio = self._sio

	def get_socket_manager(self) -> AsyncServer:
		return self._sio

and getting this error

Traceback (most recent call last):
  File "/home/ahmetk/.local/share/virtualenvs/backend-pMCPp171/lib/python3.9/site-packages/socketio/asyncio_pubsub_manager.py", line 151, in _thread
    message = await self._listen()
  File "/home/ahmetk/.local/share/virtualenvs/backend-pMCPp171/lib/python3.9/site-packages/socketio/asyncio_redis_manager.py", line 93, in _listen
    self.sub = await aioredis.create_redis(
AttributeError: module 'aioredis' has no attribute 'create_redis'
@ahmetkca ahmetkca changed the title Redis is usless as of now Cannot use AsyncRedis?? Aug 23, 2021
@miguelgrinberg
Copy link
Owner

It looks like just a couple of weeks ago aioredis released version 2, which is a complete rewrite and is not backwards compatible with version 1. For now, I suggest you downgrade your aioredis to the latest version 1. I'll keep this issue open to remind me to look at migrating to version 2.

@ahmetkca
Copy link
Author

thanks for the reply but i didn't even install aioredis it is not even in my Pipfile.

@miguelgrinberg
Copy link
Owner

@ahmetkca I'm sorry to contradict you, but you do have aioredis installed and you have the new version, which was released within the last few weeks. The error that you are getting is not "you don't have aioredis", it is "something in your aioredis isn't what I expect". So check again, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants