This commit is contained in:
parent
7ea2a911ef
commit
f03b7a8011
|
@ -53,14 +53,11 @@ class RedisCache:
|
||||||
pubsub = self._client.pubsub()
|
pubsub = self._client.pubsub()
|
||||||
await pubsub.subscribe(channel)
|
await pubsub.subscribe(channel)
|
||||||
|
|
||||||
try:
|
while True:
|
||||||
while True:
|
message = await pubsub.get_message()
|
||||||
message = await pubsub.get_message()
|
if message and isinstance(message['data'], (str, bytes, bytearray)):
|
||||||
if message:
|
yield json.loads(message['data'])
|
||||||
yield json.loads(message['data'])
|
await asyncio.sleep(0.1)
|
||||||
await asyncio.sleep(0.1)
|
|
||||||
finally:
|
|
||||||
await pubsub.unsubscribe(channel)
|
|
||||||
|
|
||||||
|
|
||||||
redis = RedisCache()
|
redis = RedisCache()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user