I'm new to manipulate connection with Redis server in python. I'm wondering that is there any way to figure out the situation below:
What I'm doing is
There are three mainly step for my program:
1. subscribe channel on Redis
2. Get the message from Redis and convert to custom model(or dict)
3. Sent the custom model to my server using socketio
What I write is
async def subscribeRedisChannel():
for item in r.subscriber.listen():
logger.info("[DEBUG]Checkin Result from Redis: {}".format(item))
if item['type'] == 'message':
checkInSubject.on_next(item)
await sio.emit('punchByEquipment', data = keep.value)
Environment
python3
socketio
asyncio
rx
redis
The problem I faced
if I call the subscribeRedisChannel function in my main function, the program will be hang on it. Other program cannot work correctly.