Skip to content

Commit

Permalink
Use new asyncio support in redis package (Fixes #911)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Apr 23, 2022
1 parent 16243e7 commit 0e7691b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/socketio/asyncio_redis_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
import pickle

try:
import aioredis
from redis import asyncio as aioredis
except ImportError:
aioredis = None
try:
import aioredis
except ImportError:
aioredis = None

from .asyncio_pubsub_manager import AsyncPubSubManager

Expand Down Expand Up @@ -39,8 +42,7 @@ def __init__(self, url='redis://localhost:6379/0', channel='socketio',
write_only=False, logger=None, redis_options=None):
if aioredis is None:
raise RuntimeError('Redis package is not installed '
'(Run "pip install aioredis" in your '
'virtualenv).')
'(Run "pip install redis" in your virtualenv).')
if not hasattr(aioredis.Redis, 'from_url'):
raise RuntimeError('Version 2 of aioredis package is required.')
self.redis_url = url
Expand Down

0 comments on commit 0e7691b

Please sign in to comment.