示例#1
0
 async def consume_from_channel(self, channel: aioredis.Channel):
     
     try:
         # print(f"consume from channel : {channel.name}")
         # print(f"        is active : {channel.is_active}")
         try:
             msg = await asyncio.wait_for(channel.get(), timeout=0.1)
             return msg
         except :
             pass
     except Exception as e:
         logging.error(stackprinter.format(e, style="darkbg2")) 
    async def consume_from_channel(self, channel: aioredis.Channel):

        try:
            # some data channels might not send any data for some period
            # if we don't time out we may block the loop
            try:
                msg = await asyncio.wait_for(channel.get(), timeout=0.01)
                await handle_msg(msg)
            except:
                pass
        except Exception as e:
            logging.error(stackprinter.format(e, style="darkbg2"))