self.loop.run_until_complete(asyncio.gather(self.handle_get_redis_msg(), self.handle_worker()))
while True:
await asyncio.sleep(1)
await self.redis.hset('XXX', 'XXX', 'XXX')
async def handle_get_redis_msg(self):
if not self.redis:
await self.get_redis()
subscribe_list = ['YYY']
if not self.pubsub:
self.pubsub = await asyncio.wait_for(self.redis.start_subscribe(), 1)
await asyncio.wait_for(self.pubsub.subscribe(subscribe_list), 1)
while True:
msg_redis = await self.pubsub.next_published()
if msg_redis:
a = 1
А у self.redis какой тип?
--
You received this message because you are subscribed to the Google Groups "aio-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aio-libs+u...@googlegroups.com.
To post to this group, send email to aio-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aio-libs/a2ef4ee0-43b4-4c5a-8fbf-5bb3f055cac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
try:
if 'poolsize' in kwargs:
self.redis = await asyncio.wait_for(
asyncio_redis.Pool.create(host=host, port=port, db=db, **kwargs), 1)
else:
self.redis = await asyncio.wait_for(
asyncio_redis.Connection.create(host=host, port=port, db=db, **kwargs), 1)
Одно соединение к редису блокируется ожиданием сообщения от pubsub
To view this discussion on the web visit https://groups.google.com/d/msgid/aio-libs/26b32057-0e3e-453d-bdaa-49d9d67d54ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.